hgbook
view web/hgbook/admin.py @ 1107:56dbd7295704
2.8.3 first 3 para zh translated
author | Zhaoping Sun <zhaopingsun@gmail.com> |
---|---|
date | Wed Dec 23 23:02:50 2009 -0500 (2009-12-23) |
parents | c17f8bffc9e5 |
children |
line source
1 from django.contrib import admin
2 from hgbook.comments.models import Comment, Element
4 class CommentAdmin(admin.ModelAdmin):
5 list_display = ['element', 'submitter_name', 'comment', 'reviewed',
6 'hidden', 'date']
7 search_fields = ['comment']
8 date_hierarchy = 'date'
9 list_filter = ['date', 'submitter_name']
10 search_fields = ['title', 'submitter_name', 'submitter_url']
11 fieldsets = (
12 (None, {'fields': ('submitter_name', 'element', 'comment')}),
13 ('Review and presentation state', {'fields': ('reviewed', 'hidden')}),
14 ('Other info', {'fields': ('submitter_url', 'ip')}),
15 )
16 # XXX: adding 'date' to the 'Other info' fieldset results in a
17 # ImproperlyConfigured error. :S
19 class ElementAdmin(admin.ModelAdmin):
20 search_fields = ['id', 'chapter']
21 list_filter = ['chapter', 'title']
23 admin.site.register(Comment, CommentAdmin)
24 admin.site.register(Element, ElementAdmin)