diff gpp/bio/models.py @ 147:152d77265da6

Implement #38: add function to mark user as a spammer. Display only active members on member list. Display login form as table (not sure why wasn't doing this before).
author Brian Neal <bgneal@gmail.com>
date Sun, 13 Dec 2009 08:11:16 +0000
parents 7ea842744a57
children b4305e18d3af
line wrap: on
line diff
--- a/gpp/bio/models.py	Wed Dec 09 22:58:05 2009 +0000
+++ b/gpp/bio/models.py	Sun Dec 13 08:11:16 2009 +0000
@@ -13,6 +13,16 @@
 from core.markup import SiteMarkup
 
 
+(STA_ACTIVE, STA_RESIGNED, STA_REMOVED, STA_SUSPENDED, STA_SPAMMER) = range(5)
+
+USER_STATUS_CHOICES = (
+    (STA_ACTIVE, "Active"),
+    (STA_RESIGNED, "Resigned"),
+    (STA_REMOVED, "Removed"),
+    (STA_SUSPENDED, "Suspended"),
+    (STA_SPAMMER, "Spammer"),
+)
+
 def avatar_file_path_for_user(username, filename):
     return os.path.join(settings.AVATAR_DIR, 'users', username, filename)
 
@@ -39,6 +49,9 @@
             default='US/Pacific')
     use_24_time = models.BooleanField(default=False)
     forum_post_count = models.IntegerField(default=0)
+    status = models.IntegerField(default=STA_ACTIVE,
+            choices=USER_STATUS_CHOICES)
+    status_date = models.DateTimeField(auto_now_add=True)
 
     def __unicode__(self):
         return self.user.username