sphinx_django/admin.py
author amit
Thu, 30 Sep 2010 11:36:30 +0530
changeset 0 54f784230511
permissions -rw-r--r--
Initial commit of django based commenting system for sphinx. Already has most of the boiler plate code.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     1
from django.contrib import admin
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     2
from sphinx_django.sphinxcomment.models import Comment, Element
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     3
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     4
class CommentAdmin(admin.ModelAdmin):
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     5
    list_display = ['element', 'submitter_name', 'comment', 'reviewed',
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     6
                    'hidden', 'date']
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     7
    search_fields = ['comment']
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     8
    date_hierarchy = 'date'
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     9
    list_filter = ['date', 'submitter_name']
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    10
    search_fields = ['title', 'submitter_name', 'submitter_url']
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    11
    fieldsets = (
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    12
        (None, {'fields': ('submitter_name', 'element', 'comment')}),
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    13
        ('Review and presentation state', {'fields': ('reviewed', 'hidden')}),
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    14
        ('Other info', {'fields': ('submitter_url', 'ip')}),
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    15
        )
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    16
    # XXX: adding 'date' to the 'Other info' fieldset results in a
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    17
    # ImproperlyConfigured error. :S
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    18
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    19
class ElementAdmin(admin.ModelAdmin):
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    20
    search_fields = ['id', 'chapter_name']
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    21
    list_filter = ['chapter_name', 'title']
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    22
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    23
admin.site.register(Comment, CommentAdmin)
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    24
admin.site.register(Element, ElementAdmin)