web/hgbook/admin.py~
changeset 0 8083d21c0020
equal deleted inserted replaced
-1:000000000000 0:8083d21c0020
       
     1 from django.contrib import admin
       
     2 from hgbook.comments.models import Comment, Element
       
     3 
       
     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
       
    18 
       
    19 class ElementAdmin(admin.ModelAdmin):
       
    20     search_fields = ['id']
       
    21 #    list_filter = ['chapter', 'title']
       
    22 
       
    23 admin.site.register(Comment, CommentAdmin)
       
    24 admin.site.register(Element, ElementAdmin)