annotate gpp/comments/admin.py @ 197:2baadae33f2e

Got autocomplete working for the member search. Updated django and ran into a bug where url tags with comma separated kwargs starting consuming tons of CPU throughput. The work-around is to cut over to using spaces between arguments. This is now allowed to be consistent with other tags. Did some query optimization for the news app.
author Brian Neal <bgneal@gmail.com>
date Sat, 10 Apr 2010 04:32:24 +0000
parents 91a01b8b5885
children b4305e18d3af
rev   line source
gremmie@1 1 """
gremmie@1 2 This file contains the automatic admin site definitions for the comment models.
gremmie@1 3 """
gremmie@1 4 from django.contrib import admin
gremmie@1 5 from comments.models import Comment
gremmie@1 6 from comments.models import CommentFlag
gremmie@1 7
gremmie@1 8 class CommentAdmin(admin.ModelAdmin):
gremmie@1 9 fieldsets = (
gremmie@1 10 (None,
gremmie@1 11 {'fields': ('content_type', 'object_id', )}
gremmie@1 12 ),
gremmie@1 13 ('Content',
gremmie@1 14 {'fields': ('user', 'comment')}
gremmie@1 15 ),
gremmie@1 16 ('Metadata',
gremmie@1 17 {'fields': ('ip_address', 'is_public', 'is_removed')}
gremmie@1 18 ),
gremmie@1 19 )
bgneal@140 20 list_display = ('__unicode__', 'content_type', 'object_id', 'ip_address',
bgneal@140 21 'creation_date', 'is_public', 'not_removed')
gremmie@1 22 list_filter = ('creation_date', 'is_public', 'is_removed')
gremmie@1 23 date_hierarchy = 'creation_date'
gremmie@1 24 ordering = ('-creation_date', )
gremmie@1 25 search_fields = ('comment', 'user__username', 'ip_address')
gremmie@1 26 raw_id_fields = ('user', 'content_type')
gremmie@1 27
gremmie@1 28 class CommentFlagAdmin(admin.ModelAdmin):
bgneal@13 29 list_display = ('__unicode__', 'flag_date', 'get_comment_url')
gremmie@1 30
gremmie@1 31 admin.site.register(Comment, CommentAdmin)
gremmie@1 32 admin.site.register(CommentFlag, CommentFlagAdmin)