Show More
@@ -144,17 +144,13 b' class Post(models.Model, Viewable):' | |||||
144 | return self.opening |
|
144 | return self.opening | |
145 |
|
145 | |||
146 | def get_absolute_url(self, thread=None): |
|
146 | def get_absolute_url(self, thread=None): | |
147 | url = None |
|
147 | # Url is cached only for the "main" thread. When getting url | |
148 |
|
148 | # for other threads, do it manually. | ||
149 | if thread is None: |
|
149 | url = self.url | |
150 | thread = self.get_thread() |
|
|||
151 |
|
||||
152 | # Url is cached only for the "main" thread. When getting url |
|
|||
153 | # for other threads, do it manually. |
|
|||
154 | if self.url: |
|
|||
155 | url = self.url |
|
|||
156 |
|
150 | |||
157 | if url is None: |
|
151 | if url is None: | |
|
152 | if thread is None: | |||
|
153 | thread = self.get_thread() | |||
158 | opening = self.is_opening() |
|
154 | opening = self.is_opening() | |
159 | opening_id = self.id if opening else thread.get_opening_post_id() |
|
155 | opening_id = self.id if opening else thread.get_opening_post_id() | |
160 | url = reverse('thread', kwargs={'post_id': opening_id}) |
|
156 | url = reverse('thread', kwargs={'post_id': opening_id}) |
@@ -231,7 +231,7 b' class Thread(models.Model):' | |||||
231 | return self.get_opening_post().pub_time |
|
231 | return self.get_opening_post().pub_time | |
232 |
|
232 | |||
233 | def __str__(self): |
|
233 | def __str__(self): | |
234 |
return 'T# |
|
234 | return 'T#{}'.format(self.id) | |
235 |
|
235 | |||
236 | def get_tag_url_list(self) -> list: |
|
236 | def get_tag_url_list(self) -> list: | |
237 | return boards.models.Tag.objects.get_tag_url_list(self.get_tags()) |
|
237 | return boards.models.Tag.objects.get_tag_url_list(self.get_tags()) |
General Comments 0
You need to be logged in to leave comments.
Login now