Show More
@@ -152,9 +152,10 b' class Post(models.Model, Viewable):' | |||||
152 | url = self.url |
|
152 | url = self.url | |
153 |
|
153 | |||
154 | if url is None: |
|
154 | if url is None: | |
155 |
opening |
|
155 | opening = self.is_opening() | |
|
156 | opening_id = self.id if opening else thread.get_opening_post_id() | |||
156 | url = reverse('thread', kwargs={'post_id': opening_id}) |
|
157 | url = reverse('thread', kwargs={'post_id': opening_id}) | |
157 |
if |
|
158 | if not opening: | |
158 | url += '#' + str(self.id) |
|
159 | url += '#' + str(self.id) | |
159 |
|
160 | |||
160 | return url |
|
161 | return url | |
@@ -292,8 +293,7 b' class Post(models.Model, Viewable):' | |||||
292 |
|
293 | |||
293 | super().save(force_insert, force_update, using, update_fields) |
|
294 | super().save(force_insert, force_update, using, update_fields) | |
294 |
|
295 | |||
295 | # Post save triggers |
|
296 | if self.url is None: | |
296 | if new_post: |
|
|||
297 | self.build_url() |
|
297 | self.build_url() | |
298 |
|
298 | |||
299 | self._connect_replies() |
|
299 | self._connect_replies() |
@@ -100,7 +100,8 b' def cached_result(key_method=None):' | |||||
100 | result = persisted_result |
|
100 | result = persisted_result | |
101 | else: |
|
101 | else: | |
102 | result = function(obj, *args, **kwargs) |
|
102 | result = function(obj, *args, **kwargs) | |
103 | cache.set(cache_key, result) |
|
103 | if result is not None: | |
|
104 | cache.set(cache_key, result) | |||
104 |
|
105 | |||
105 | return result |
|
106 | return result | |
106 |
|
107 |
General Comments 0
You need to be logged in to leave comments.
Login now