diff --git a/boards/models/post/__init__.py b/boards/models/post/__init__.py --- a/boards/models/post/__init__.py +++ b/boards/models/post/__init__.py @@ -144,17 +144,13 @@ class Post(models.Model, Viewable): return self.opening def get_absolute_url(self, thread=None): - url = None - - if thread is None: - thread = self.get_thread() - - # Url is cached only for the "main" thread. When getting url - # for other threads, do it manually. - if self.url: - url = self.url + # Url is cached only for the "main" thread. When getting url + # for other threads, do it manually. + url = self.url if url is None: + if thread is None: + thread = self.get_thread() opening = self.is_opening() opening_id = self.id if opening else thread.get_opening_post_id() url = reverse('thread', kwargs={'post_id': opening_id}) diff --git a/boards/models/thread.py b/boards/models/thread.py --- a/boards/models/thread.py +++ b/boards/models/thread.py @@ -231,7 +231,7 @@ class Thread(models.Model): return self.get_opening_post().pub_time def __str__(self): - return 'T#{}/{}'.format(self.id, self.get_opening_post_id()) + return 'T#{}'.format(self.id) def get_tag_url_list(self) -> list: return boards.models.Tag.objects.get_tag_url_list(self.get_tags())