Mercurial > public > sg101
comparison gpp/bio/models.py @ 138:7ea842744a57
Ticket #15, add a way to report user profiles.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Fri, 27 Nov 2009 21:55:32 +0000 |
parents | 48621ba5c385 |
children | 152d77265da6 |
comparison
equal
deleted
inserted
replaced
137:c7d75cdfea21 | 138:7ea842744a57 |
---|---|
50 sm = SiteMarkup() | 50 sm = SiteMarkup() |
51 self.profile_html = sm.convert(self.profile_text) | 51 self.profile_html = sm.convert(self.profile_text) |
52 self.signature_html = sm.convert(self.signature) | 52 self.signature_html = sm.convert(self.signature) |
53 super(UserProfile, self).save(*args, **kwargs) | 53 super(UserProfile, self).save(*args, **kwargs) |
54 cache.delete('avatar_' + self.user.username) | 54 cache.delete('avatar_' + self.user.username) |
55 | |
56 @models.permalink | |
57 def get_absolute_url(self): | |
58 return ('bio-view_profile', (), {'username': self.user.username}) | |
59 | |
60 | |
61 class UserProfileFlag(models.Model): | |
62 """This model represents a user flagging a profile as inappropriate.""" | |
63 user = models.ForeignKey(auth.models.User) | |
64 profile = models.ForeignKey(UserProfile) | |
65 flag_date = models.DateTimeField(auto_now_add=True) | |
66 | |
67 def __unicode__(self): | |
68 return u"%s's profile flagged by %s" % (self.profile.user.username, | |
69 self.user.username) | |
70 | |
71 class Meta: | |
72 ordering = ('flag_date', ) | |
73 | |
74 def get_profile_url(self): | |
75 return '<a href="%s">Profile</a>' % self.profile.get_absolute_url() | |
76 get_profile_url.allow_tags = True |