##// END OF EJS Templates
Merged with default branch
neko259 -
r1534:fc74f02b merge decentral
parent child Browse files
Show More
@@ -7,7 +7,6 b' from boards.models import PostImage, Att'
7 from boards.models.base import Viewable
7 from boards.models.base import Viewable
8 from boards.models.post.export import get_exporter, DIFF_TYPE_JSON
8 from boards.models.post.export import get_exporter, DIFF_TYPE_JSON
9 from boards.models.post.manager import PostManager
9 from boards.models.post.manager import PostManager
10 from boards.utils import cached_result
11 from boards.utils import datetime_to_epoch
10 from boards.utils import datetime_to_epoch
12 from django.core.exceptions import ObjectDoesNotExist
11 from django.core.exceptions import ObjectDoesNotExist
13 from django.core.urlresolvers import reverse
12 from django.core.urlresolvers import reverse
@@ -176,10 +175,6 b' class Post(models.Model, Viewable):'
176 def _get_cache_key(self):
175 def _get_cache_key(self):
177 return [datetime_to_epoch(self.last_edit_time)]
176 return [datetime_to_epoch(self.last_edit_time)]
178
177
179 @cached_result(key_method=_get_cache_key)
180 def get_thread_count(self):
181 return self.get_threads().count()
182
183 def get_view(self, *args, **kwargs) -> str:
178 def get_view(self, *args, **kwargs) -> str:
184 """
179 """
185 Renders post's HTML view. Some of the post params can be passed over
180 Renders post's HTML view. Some of the post params can be passed over
@@ -353,17 +348,6 b' class Post(models.Model, Viewable):'
353
348
354 return text
349 return text
355
350
356 def get_absolute_id(self) -> str:
357 """
358 If the post has many threads, shows its main thread OP id in the post
359 ID.
360 """
361
362 if self.get_thread_count() > 1:
363 return '{}/{}'.format(self.get_thread().get_opening_post_id(), self.id)
364 else:
365 return str(self.id)
366
367 def connect_threads(self, opening_posts):
351 def connect_threads(self, opening_posts):
368 for opening_post in opening_posts:
352 for opening_post in opening_posts:
369 threads = opening_post.get_threads().all()
353 threads = opening_post.get_threads().all()
@@ -5,7 +5,7 b''
5
5
6 <div class="{{ css_class }}" id="{{ post.id }}" data-uid="{{ post.uid }}" {% if tree_depth %}style="margin-left: {{ tree_depth }}em;"{% endif %}>
6 <div class="{{ css_class }}" id="{{ post.id }}" data-uid="{{ post.uid }}" {% if tree_depth %}style="margin-left: {{ tree_depth }}em;"{% endif %}>
7 <div class="post-info">
7 <div class="post-info">
8 <a class="post_id" href="{{ post.get_absolute_url }}">#{{ post.get_absolute_id }}</a>
8 <a class="post_id" href="{{ post.get_absolute_url }}">#{{ post.id }}</a>
9 <span class="title">{{ post.title }}</span>
9 <span class="title">{{ post.title }}</span>
10 <span class="pub_time"><time datetime="{{ post.pub_time|date:'c' }}">{{ post.pub_time }}</time></span>
10 <span class="pub_time"><time datetime="{{ post.pub_time|date:'c' }}">{{ post.pub_time }}</time></span>
11 {% if post.tripcode %}
11 {% if post.tripcode %}
General Comments 0
You need to be logged in to leave comments. Login now