Mercurial > public > sg101
comparison 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 |
comparison
equal
deleted
inserted
replaced
146:023132c90021 | 147:152d77265da6 |
---|---|
10 from django.conf import settings | 10 from django.conf import settings |
11 from django.core.cache import cache | 11 from django.core.cache import cache |
12 | 12 |
13 from core.markup import SiteMarkup | 13 from core.markup import SiteMarkup |
14 | 14 |
15 | |
16 (STA_ACTIVE, STA_RESIGNED, STA_REMOVED, STA_SUSPENDED, STA_SPAMMER) = range(5) | |
17 | |
18 USER_STATUS_CHOICES = ( | |
19 (STA_ACTIVE, "Active"), | |
20 (STA_RESIGNED, "Resigned"), | |
21 (STA_REMOVED, "Removed"), | |
22 (STA_SUSPENDED, "Suspended"), | |
23 (STA_SPAMMER, "Spammer"), | |
24 ) | |
15 | 25 |
16 def avatar_file_path_for_user(username, filename): | 26 def avatar_file_path_for_user(username, filename): |
17 return os.path.join(settings.AVATAR_DIR, 'users', username, filename) | 27 return os.path.join(settings.AVATAR_DIR, 'users', username, filename) |
18 | 28 |
19 def avatar_file_path(instance, filename): | 29 def avatar_file_path(instance, filename): |
37 avatar = models.ImageField(upload_to=avatar_file_path, blank=True) | 47 avatar = models.ImageField(upload_to=avatar_file_path, blank=True) |
38 time_zone = models.CharField(max_length=64, blank=True, | 48 time_zone = models.CharField(max_length=64, blank=True, |
39 default='US/Pacific') | 49 default='US/Pacific') |
40 use_24_time = models.BooleanField(default=False) | 50 use_24_time = models.BooleanField(default=False) |
41 forum_post_count = models.IntegerField(default=0) | 51 forum_post_count = models.IntegerField(default=0) |
52 status = models.IntegerField(default=STA_ACTIVE, | |
53 choices=USER_STATUS_CHOICES) | |
54 status_date = models.DateTimeField(auto_now_add=True) | |
42 | 55 |
43 def __unicode__(self): | 56 def __unicode__(self): |
44 return self.user.username | 57 return self.user.username |
45 | 58 |
46 class Meta: | 59 class Meta: |