Show More
@@ -99,7 +99,7 b' class PostManager(models.Manager):' | |||||
99 | Delete post and update or delete its thread |
|
99 | Delete post and update or delete its thread | |
100 | """ |
|
100 | """ | |
101 |
|
101 | |||
102 |
thread = post.thread |
|
102 | thread = post.get_thread() | |
103 |
|
103 | |||
104 | if post.is_opening(): |
|
104 | if post.is_opening(): | |
105 | thread.delete_with_posts() |
|
105 | thread.delete_with_posts() | |
@@ -150,7 +150,7 b' class PostManager(models.Manager):' | |||||
150 | referenced_post.last_edit_time = post.pub_time |
|
150 | referenced_post.last_edit_time = post.pub_time | |
151 | referenced_post.save() |
|
151 | referenced_post.save() | |
152 |
|
152 | |||
153 |
referenced_thread = referenced_post.thread |
|
153 | referenced_thread = referenced_post.get_thread() | |
154 | referenced_thread.last_edit_time = post.pub_time |
|
154 | referenced_thread.last_edit_time = post.pub_time | |
155 | referenced_thread.save() |
|
155 | referenced_thread.save() | |
156 |
|
156 | |||
@@ -253,7 +253,7 b' class Post(models.Model):' | |||||
253 | return self.referenced_posts.exists() |
|
253 | return self.referenced_posts.exists() | |
254 |
|
254 | |||
255 | def is_opening(self): |
|
255 | def is_opening(self): | |
256 |
return self.thread |
|
256 | return self.get_thread().get_opening_post() == self | |
257 |
|
257 | |||
258 | def save(self, *args, **kwargs): |
|
258 | def save(self, *args, **kwargs): | |
259 | """ |
|
259 | """ | |
@@ -271,7 +271,7 b' class Post(models.Model):' | |||||
271 | def add_tag(self, tag): |
|
271 | def add_tag(self, tag): | |
272 | edit_time = timezone.now() |
|
272 | edit_time = timezone.now() | |
273 |
|
273 | |||
274 |
thread = self.thread |
|
274 | thread = self.get_thread() | |
275 | thread.add_tag(tag) |
|
275 | thread.add_tag(tag) | |
276 | self.last_edit_time = edit_time |
|
276 | self.last_edit_time = edit_time | |
277 | self.save() |
|
277 | self.save() | |
@@ -283,7 +283,7 b' class Post(models.Model):' | |||||
283 | def remove_tag(self, tag): |
|
283 | def remove_tag(self, tag): | |
284 | edit_time = timezone.now() |
|
284 | edit_time = timezone.now() | |
285 |
|
285 | |||
286 |
thread = self.thread |
|
286 | thread = self.get_thread() | |
287 | thread.remove_tag(tag) |
|
287 | thread.remove_tag(tag) | |
288 | self.last_edit_time = edit_time |
|
288 | self.last_edit_time = edit_time | |
289 | self.save() |
|
289 | self.save() | |
@@ -301,7 +301,7 b' class Post(models.Model):' | |||||
301 |
|
301 | |||
302 | if not link: |
|
302 | if not link: | |
303 | if not opening_id: |
|
303 | if not opening_id: | |
304 |
opening_post = self.thread |
|
304 | opening_post = self.get_thread().get_opening_post() | |
305 | opening_id = opening_post.id |
|
305 | opening_id = opening_post.id | |
306 |
|
306 | |||
307 | if self.id != opening_id: |
|
307 | if self.id != opening_id: |
General Comments 0
You need to be logged in to leave comments.
Login now