Permalink
Browse files

Handle anonymous users in comment flags - closes #369

  • Loading branch information...
1 parent cddee40 commit 5d46ca42c5495997d69d9bc547417258593c16d8 @evdb evdb committed Mar 21, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 mzalendo/comments2/models.py
@@ -154,7 +154,12 @@ class Meta:
verbose_name_plural = _('comment flags')
def __unicode__(self):
- return "Flag of comment ID %s by %s" % (self.comment_id, self.user.username)
+ if self.user:
+ username = self.user.username
+ else:
+ username = 'anonymous'
+
+ return "Flag of comment ID %s by %s" % (self.comment_id, username)
def save(self, *args, **kwargs):
if self.flag_date is None:

0 comments on commit 5d46ca4

Please sign in to comment.