Django

Code

root/django/trunk/django/contrib/comments/admin.py

Revision 9038, 0.9 kB (checked in by wilson, 2 months ago)

Fixed #8917 -- Comments are now displayed in reverse order by submit_date in the admin. Thanks to arien for the patch.

Line 
1 from django.contrib import admin
2 from django.conf import settings
3 from django.contrib.comments.models import Comment
4 from django.utils.translation import ugettext_lazy as _
5
6 class CommentsAdmin(admin.ModelAdmin):
7     fieldsets = (
8         (None,
9            {'fields': ('content_type', 'object_pk', 'site')}
10         ),
11         (_('Content'),
12            {'fields': ('user', 'user_name', 'user_email', 'user_url', 'comment')}
13         ),
14         (_('Metadata'),
15            {'fields': ('submit_date', 'ip_address', 'is_public', 'is_removed')}
16         ),
17      )
18
19     list_display = ('name', 'content_type', 'object_pk', 'ip_address', 'submit_date', 'is_public', 'is_removed')
20     list_filter = ('submit_date', 'site', 'is_public', 'is_removed')
21     date_hierarchy = 'submit_date'
22     ordering = ('-submit_date',)
23     search_fields = ('comment', 'user__username', 'user_name', 'user_email', 'user_url', 'ip_address')
24
25 admin.site.register(Comment, CommentsAdmin)
Note: See TracBrowser for help on using the browser.