##// END OF EJS Templates
Post URL loading optimizations
neko259 -
r1668:b8867a5d default
parent child Browse files
Show More
@@ -144,17 +144,13 b' class Post(models.Model, Viewable):'
144 144 return self.opening
145 145
146 146 def get_absolute_url(self, thread=None):
147 url = None
148
149 if thread is None:
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
147 # Url is cached only for the "main" thread. When getting url
148 # for other threads, do it manually.
149 url = self.url
156 150
157 151 if url is None:
152 if thread is None:
153 thread = self.get_thread()
158 154 opening = self.is_opening()
159 155 opening_id = self.id if opening else thread.get_opening_post_id()
160 156 url = reverse('thread', kwargs={'post_id': opening_id})
@@ -231,7 +231,7 b' class Thread(models.Model):'
231 231 return self.get_opening_post().pub_time
232 232
233 233 def __str__(self):
234 return 'T#{}/{}'.format(self.id, self.get_opening_post_id())
234 return 'T#{}'.format(self.id)
235 235
236 236 def get_tag_url_list(self) -> list:
237 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