SEESenv/web/hgbook/admin.py~
author amit@thunder
Thu, 04 Mar 2010 14:33:38 +0530
changeset 43 134b87b382f5
parent 2 52d12eb31c30
permissions -rwxr-xr-x
Made changes so that the files so that files above chapter 10 do not come twice also changed the name so that any chapter beyond 9 is listed in the end
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     1
from django.contrib import admin
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     2
from hgbook.comments.models import Comment, Element
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     3
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     4
class CommentAdmin(admin.ModelAdmin):
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     5
    list_display = ['element', 'submitter_name', 'comment', 'reviewed',
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     6
                    'hidden', 'date']
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     7
    search_fields = ['comment']
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     8
    date_hierarchy = 'date'
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     9
    list_filter = ['date', 'submitter_name']
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    10
    search_fields = ['title', 'submitter_name', 'submitter_url']
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    11
    fieldsets = (
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    12
        (None, {'fields': ('submitter_name', 'element', 'comment')}),
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    13
        ('Review and presentation state', {'fields': ('reviewed', 'hidden')}),
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    14
        ('Other info', {'fields': ('submitter_url', 'ip')}),
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    15
        )
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    16
    # XXX: adding 'date' to the 'Other info' fieldset results in a
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    17
    # ImproperlyConfigured error. :S
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    18
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    19
class ElementAdmin(admin.ModelAdmin):
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    20
    search_fields = ['id']
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    21
#    list_filter = ['chapter', 'title']
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    22
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    23
admin.site.register(Comment, CommentAdmin)
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    24
admin.site.register(Element, ElementAdmin)