##// END OF EJS Templates
Fixed building reflink maps that were broken when post link generator was...
neko259 -
r1192:cfe10bce default
parent child Browse files
Show More
@@ -115,12 +115,11 b' class PostManager(models.Manager):'
115 thread.bump()
115 thread.bump()
116 thread.save()
116 thread.save()
117
117
118 post.build_url()
118 post.connect_replies()
119 post.connect_replies()
119 post.connect_threads(threads)
120 post.connect_threads(threads)
120 post.connect_notifications()
121 post.connect_notifications()
121
122
122 post.build_url()
123
124 return post
123 return post
125
124
126 def delete_posts_by_ip(self, ip):
125 def delete_posts_by_ip(self, ip):
@@ -229,7 +228,15 b' class Post(models.Model, Viewable):'
229 return self.get_thread().get_opening_post_id() == self.id
228 return self.get_thread().get_opening_post_id() == self.id
230
229
231 def get_absolute_url(self):
230 def get_absolute_url(self):
232 return self.url
231 if self.url:
232 return self.url
233 else:
234 opening_id = self.get_thread().get_opening_post_id()
235 post_url = reverse('thread', kwargs={'post_id': opening_id})
236 if self.id != opening_id:
237 post_url += '#' + str(self.id)
238 return post_url
239
233
240
234 def get_thread(self):
241 def get_thread(self):
235 return self.thread
242 return self.thread
@@ -341,12 +348,7 b' class Post(models.Model, Viewable):'
341 pass
348 pass
342
349
343 def build_url(self):
350 def build_url(self):
344 thread = self.get_thread()
351 self.url = self.get_absolute_url()
345 opening_id = thread.get_opening_post_id()
346 post_url = reverse('thread', kwargs={'post_id': opening_id})
347 if self.id != opening_id:
348 post_url += '#' + str(self.id)
349 self.url = post_url
350 self.save(update_fields=['url'])
352 self.save(update_fields=['url'])
351
353
352 def save(self, force_insert=False, force_update=False, using=None,
354 def save(self, force_insert=False, force_update=False, using=None,
General Comments 0
You need to be logged in to leave comments. Login now