web/lib/django/contrib/comments/admin.py
changeset 0 0d40e90630ef
child 29 cc9b7e14412b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/django/contrib/comments/admin.py	Wed Jan 20 00:34:04 2010 +0100
@@ -0,0 +1,29 @@
+from django.contrib import admin
+from django.contrib.comments.models import Comment
+from django.utils.translation import ugettext_lazy as _
+from django.contrib.comments import get_model
+
+class CommentsAdmin(admin.ModelAdmin):
+    fieldsets = (
+        (None,
+           {'fields': ('content_type', 'object_pk', 'site')}
+        ),
+        (_('Content'),
+           {'fields': ('user', 'user_name', 'user_email', 'user_url', 'comment')}
+        ),
+        (_('Metadata'),
+           {'fields': ('submit_date', 'ip_address', 'is_public', 'is_removed')}
+        ),
+     )
+
+    list_display = ('name', 'content_type', 'object_pk', 'ip_address', 'submit_date', 'is_public', 'is_removed')
+    list_filter = ('submit_date', 'site', 'is_public', 'is_removed')
+    date_hierarchy = 'submit_date'
+    ordering = ('-submit_date',)
+    raw_id_fields = ('user',)
+    search_fields = ('comment', 'user__username', 'user_name', 'user_email', 'user_url', 'ip_address')
+
+# Only register the default admin if the model is the built-in comment model
+# (this won't be true if there's a custom comment app).
+if get_model() is Comment:
+    admin.site.register(Comment, CommentsAdmin)