Show More
@@ -87,8 +87,7 b' class Thread(models.Model):' | |||||
87 | if reply_count > 0: |
|
87 | if reply_count > 0: | |
88 | reply_count_to_show = min(settings.LAST_REPLIES_COUNT, |
|
88 | reply_count_to_show = min(settings.LAST_REPLIES_COUNT, | |
89 | reply_count - 1) |
|
89 | reply_count - 1) | |
90 |
replies = self.replies |
|
90 | replies = self.get_replies() | |
91 | 'poster_user_agent', 'text_markup_type') |
|
|||
92 | last_replies = replies[reply_count - reply_count_to_show:] |
|
91 | last_replies = replies[reply_count - reply_count_to_show:] | |
93 |
|
92 | |||
94 | return last_replies |
|
93 | return last_replies | |
@@ -107,7 +106,7 b' class Thread(models.Model):' | |||||
107 | Gets sorted thread posts |
|
106 | Gets sorted thread posts | |
108 | """ |
|
107 | """ | |
109 |
|
108 | |||
110 | query = self.replies.order_by('pub_time') |
|
109 | query = self.replies.order_by('pub_time').prefetch_related('images') | |
111 | if view_fields_only: |
|
110 | if view_fields_only: | |
112 | query = query.defer('poster_user_agent', 'text_markup_type') |
|
111 | query = query.defer('poster_user_agent', 'text_markup_type') | |
113 | return query.all() |
|
112 | return query.all() | |
@@ -161,4 +160,4 b' class Thread(models.Model):' | |||||
161 | Gets opening post's pub time because thread does not have its own one. |
|
160 | Gets opening post's pub time because thread does not have its own one. | |
162 | """ |
|
161 | """ | |
163 |
|
162 | |||
164 | return self.get_opening_post().pub_time No newline at end of file |
|
163 | return self.get_opening_post().pub_time |
@@ -47,7 +47,7 b'' | |||||
47 | {% endif %} |
|
47 | {% endif %} | |
48 | </div> |
|
48 | </div> | |
49 | {% if post.images.exists %} |
|
49 | {% if post.images.exists %} | |
50 |
{% with post. |
|
50 | {% with post.images.all.0 as image %} | |
51 | <div class="image"> |
|
51 | <div class="image"> | |
52 | <a |
|
52 | <a | |
53 | class="thumb" |
|
53 | class="thumb" |
General Comments 0
You need to be logged in to leave comments.
Login now