changeset 140:91a01b8b5885

Comments: in order to show a green board concept while looking at the comments in the admin, added a 'not removed' boolean function.
author Brian Neal <bgneal@gmail.com>
date Mon, 30 Nov 2009 03:20:24 +0000
parents e04d91babfcf
children 861f7d5f1b23
files gpp/comments/admin.py gpp/comments/models.py
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gpp/comments/admin.py	Sun Nov 29 22:33:15 2009 +0000
+++ b/gpp/comments/admin.py	Mon Nov 30 03:20:24 2009 +0000
@@ -17,7 +17,8 @@
            {'fields': ('ip_address', 'is_public', 'is_removed')}
         ),
      )
-    list_display = ('__unicode__', 'content_type', 'object_id', 'ip_address', 'creation_date', 'is_public', 'is_removed')
+    list_display = ('__unicode__', 'content_type', 'object_id', 'ip_address',
+            'creation_date', 'is_public', 'not_removed')
     list_filter = ('creation_date', 'is_public', 'is_removed')
     date_hierarchy = 'creation_date'
     ordering = ('-creation_date', )
--- a/gpp/comments/models.py	Sun Nov 29 22:33:15 2009 +0000
+++ b/gpp/comments/models.py	Mon Nov 30 03:20:24 2009 +0000
@@ -67,6 +67,14 @@
             args=(self.content_type_id, self.object_id)
         )
 
+    def not_removed(self):
+        """
+        Returns not self.is_removed. Used on the admin display for
+        "green board" display purposes.
+        """
+        return not self.is_removed
+    not_removed.boolean = True
+
 
 class CommentFlag(models.Model):
     """This model represents a user flagging a comment as inappropriate."""