Mercurial > public > sg101
diff 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 |
line wrap: on
line diff
--- a/gpp/bio/models.py Fri Nov 27 04:11:12 2009 +0000 +++ b/gpp/bio/models.py Fri Nov 27 21:55:32 2009 +0000 @@ -52,3 +52,25 @@ self.signature_html = sm.convert(self.signature) super(UserProfile, self).save(*args, **kwargs) cache.delete('avatar_' + self.user.username) + + @models.permalink + def get_absolute_url(self): + return ('bio-view_profile', (), {'username': self.user.username}) + + +class UserProfileFlag(models.Model): + """This model represents a user flagging a profile as inappropriate.""" + user = models.ForeignKey(auth.models.User) + profile = models.ForeignKey(UserProfile) + flag_date = models.DateTimeField(auto_now_add=True) + + def __unicode__(self): + return u"%s's profile flagged by %s" % (self.profile.user.username, + self.user.username) + + class Meta: + ordering = ('flag_date', ) + + def get_profile_url(self): + return '<a href="%s">Profile</a>' % self.profile.get_absolute_url() + get_profile_url.allow_tags = True