Show More
@@ -246,7 +246,9 b' class Post(models.Model):' | |||
|
246 | 246 | |
|
247 | 247 | def get_images_count(self): |
|
248 | 248 | images_count = 1 if self.image else 0 |
|
249 | for reply in self._get_replies(): | |
|
249 | ||
|
250 | replies = self._get_replies() | |
|
251 | for reply in replies: | |
|
250 | 252 | if reply.image: |
|
251 | 253 | images_count += 1 |
|
252 | 254 | |
@@ -255,7 +257,7 b' class Post(models.Model):' | |||
|
255 | 257 | def can_bump(self): |
|
256 | 258 | """Check if the thread can be bumped by replying""" |
|
257 | 259 | |
|
258 |
replies_count = |
|
|
260 | replies_count = self.get_reply_count() + 1 | |
|
259 | 261 | |
|
260 | 262 | return replies_count <= settings.MAX_POSTS_PER_THREAD |
|
261 | 263 | |
@@ -292,13 +294,8 b' class User(models.Model):' | |||
|
292 | 294 | return setting |
|
293 | 295 | |
|
294 | 296 | def get_setting(self, name): |
|
295 |
|
|
|
296 | if len(settings) > 0: | |
|
297 | setting = settings[0] | |
|
298 | else: | |
|
299 | setting = None | |
|
300 | ||
|
301 | if setting: | |
|
297 | if Setting.objects.filter(name=name, user=self).exists(): | |
|
298 | setting = Setting.objects.get(name=name, user=self) | |
|
302 | 299 | setting_value = setting.value |
|
303 | 300 | else: |
|
304 | 301 | setting_value = None |
@@ -23,9 +23,9 b'' | |||
|
23 | 23 | {% for thread in threads %} |
|
24 | 24 | <div class="thread"> |
|
25 | 25 | {% if thread.can_bump %} |
|
26 | <div class="post" id="{{thread.id}}"> | |
|
26 | <div class="post" id="{{thread.id}}"> | |
|
27 | 27 | {% else %} |
|
28 | <div class="post dead_post" id="{{ thread.id }}"> | |
|
28 | <div class="post dead_post" id="{{ thread.id }}"> | |
|
29 | 29 | {% endif %} |
|
30 | 30 | {% if thread.image %} |
|
31 | 31 | <div class="image"> |
@@ -64,7 +64,7 b'' | |||
|
64 | 64 | <div class="metadata"> |
|
65 | 65 | {{ thread.get_reply_count }} {% trans 'replies' %}, |
|
66 | 66 | {{ thread.get_images_count }} {% trans 'images' %}. |
|
67 |
{% if thread.tags. |
|
|
67 | {% if thread.tags.exists %} | |
|
68 | 68 | <span class="tags">{% trans 'Tags' %}: |
|
69 | 69 | {% for tag in thread.tags.all %} |
|
70 | 70 | <a class="tag" href=" |
@@ -79,9 +79,9 b'' | |||
|
79 | 79 | <div class="last-replies"> |
|
80 | 80 | {% for post in thread.get_last_replies %} |
|
81 | 81 | {% if thread.can_bump %} |
|
82 | <div class="post" id="{{ post.id }}"> | |
|
82 | <div class="post" id="{{ post.id }}"> | |
|
83 | 83 | {% else %} |
|
84 |
<div class="post dead_post id="{{ post.id }}" |
|
|
84 | <div class="post dead_post id="{{ post.id }}"> | |
|
85 | 85 | {% endif %} |
|
86 | 86 | {% if post.image %} |
|
87 | 87 | <div class="image"> |
@@ -13,7 +13,7 b'' | |||
|
13 | 13 | {% if posts %} |
|
14 | 14 | <div id="posts"> |
|
15 | 15 | {% for post in posts %} |
|
16 |
{% if |
|
|
16 | {% if bumpable %} | |
|
17 | 17 | <div class="post" id="{{ post.id }}"> |
|
18 | 18 | {% else %} |
|
19 | 19 | <div class="post dead_post" id="{{ post.id }}"> |
@@ -53,7 +53,7 b'' | |||
|
53 | 53 | {{ post.text.rendered }} |
|
54 | 54 | {% endautoescape %} |
|
55 | 55 | </div> |
|
56 |
{% if post. |
|
|
56 | {% if post.id == posts.0.id %} | |
|
57 | 57 | <div class="metadata"> |
|
58 | 58 | <span class="tags">{% trans 'Tags' %}: |
|
59 | 59 | {% for tag in post.tags.all %} |
General Comments 0
You need to be logged in to leave comments.
Login now