gremmie@1: """ gremmie@1: This file contains the automatic admin site definitions for the comment models. gremmie@1: """ gremmie@1: from django.contrib import admin gremmie@1: from comments.models import Comment gremmie@1: from comments.models import CommentFlag gremmie@1: gremmie@1: class CommentAdmin(admin.ModelAdmin): gremmie@1: fieldsets = ( gremmie@1: (None, gremmie@1: {'fields': ('content_type', 'object_id', )} gremmie@1: ), gremmie@1: ('Content', gremmie@1: {'fields': ('user', 'comment')} gremmie@1: ), gremmie@1: ('Metadata', gremmie@1: {'fields': ('ip_address', 'is_public', 'is_removed')} gremmie@1: ), gremmie@1: ) gremmie@1: list_display = ('__unicode__', 'content_type', 'object_id', 'ip_address', 'creation_date', 'is_public', 'is_removed') gremmie@1: list_filter = ('creation_date', 'is_public', 'is_removed') gremmie@1: date_hierarchy = 'creation_date' gremmie@1: ordering = ('-creation_date', ) gremmie@1: search_fields = ('comment', 'user__username', 'ip_address') gremmie@1: raw_id_fields = ('user', 'content_type') gremmie@1: gremmie@1: class CommentFlagAdmin(admin.ModelAdmin): gremmie@1: list_display = ('__unicode__', 'get_comment_url') gremmie@1: gremmie@1: admin.site.register(Comment, CommentAdmin) gremmie@1: admin.site.register(CommentFlag, CommentFlagAdmin)