# HG changeset patch # User neko259 # Date 2014-11-18 14:18:50 # Node ID dc78f601cc1429c27a68c52384ce66e445c37218 # Parent b29bd5c0dc4368816be546de4868e27be0fd821e Show thread, post and tag names in admin with python3 diff --git a/boards/models/post.py b/boards/models/post.py --- a/boards/models/post.py +++ b/boards/models/post.py @@ -230,9 +230,8 @@ class Post(models.Model, Viewable): db_index=True) refmap = models.TextField(null=True, blank=True) - def __unicode__(self): - return '#' + str(self.id) + ' ' + self.title + ' (' + \ - self.text.raw[:50] + ')' + def __str__(self): + return '#{} {} ({})'.format(self.id, self.title, self.text.raw[:50]) def get_title(self): """ diff --git a/boards/models/tag.py b/boards/models/tag.py --- a/boards/models/tag.py +++ b/boards/models/tag.py @@ -39,7 +39,7 @@ class Tag(models.Model, Viewable): threads = models.ManyToManyField(Thread, null=True, blank=True, related_name='tag+') - def __unicode__(self): + def __str__(self): return self.name def is_empty(self): diff --git a/boards/models/thread.py b/boards/models/thread.py --- a/boards/models/thread.py +++ b/boards/models/thread.py @@ -183,3 +183,6 @@ class Thread(models.Model): self.replies.all().delete() super(Thread, self).delete(using) + + def __str__(self): + return '{}/#{}'.format(self.id, self.get_opening_post_id())