Show More
@@ -7,7 +7,6 b' from boards.models import PostImage, Att' | |||
|
7 | 7 | from boards.models.base import Viewable |
|
8 | 8 | from boards.models.post.export import get_exporter, DIFF_TYPE_JSON |
|
9 | 9 | from boards.models.post.manager import PostManager |
|
10 | from boards.utils import cached_result | |
|
11 | 10 | from boards.utils import datetime_to_epoch |
|
12 | 11 | from django.core.exceptions import ObjectDoesNotExist |
|
13 | 12 | from django.core.urlresolvers import reverse |
@@ -176,10 +175,6 b' class Post(models.Model, Viewable):' | |||
|
176 | 175 | def _get_cache_key(self): |
|
177 | 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 | 178 | def get_view(self, *args, **kwargs) -> str: |
|
184 | 179 | """ |
|
185 | 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 | 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 | 351 | def connect_threads(self, opening_posts): |
|
368 | 352 | for opening_post in opening_posts: |
|
369 | 353 | threads = opening_post.get_threads().all() |
@@ -5,7 +5,7 b'' | |||
|
5 | 5 | |
|
6 | 6 | <div class="{{ css_class }}" id="{{ post.id }}" data-uid="{{ post.uid }}" {% if tree_depth %}style="margin-left: {{ tree_depth }}em;"{% endif %}> |
|
7 | 7 | <div class="post-info"> |
|
8 |
<a class="post_id" href="{{ post.get_absolute_url }}">#{{ post. |
|
|
8 | <a class="post_id" href="{{ post.get_absolute_url }}">#{{ post.id }}</a> | |
|
9 | 9 | <span class="title">{{ post.title }}</span> |
|
10 | 10 | <span class="pub_time"><time datetime="{{ post.pub_time|date:'c' }}">{{ post.pub_time }}</time></span> |
|
11 | 11 | {% if post.tripcode %} |
General Comments 0
You need to be logged in to leave comments.
Login now