diff --git a/boards/models.py b/boards/models.py --- a/boards/models.py +++ b/boards/models.py @@ -77,7 +77,7 @@ class PostManager(models.Manager): threads = threads.order_by(order_by) if page != ALL_PAGES: - thread_count = len(threads) + thread_count = threads.count() if page < self.get_thread_page_count(tag=tag): start_thread = page * settings.THREADS_PER_PAGE diff --git a/boards/templates/boards/posting_general.html b/boards/templates/boards/posting_general.html --- a/boards/templates/boards/posting_general.html +++ b/boards/templates/boards/posting_general.html @@ -22,51 +22,51 @@ {% if threads %} {% for thread in threads %}
- {% if thread.can_bump %} -
+ {% if thread.bumpable %} +
{% else %} -
+
{% endif %} - {% if thread.image %} + {% if thread.thread.image %} {% endif %}
{% autoescape off %} - {{ thread.text.rendered|truncatewords_html:50 }} + {{ thread.thread.text.rendered|truncatewords_html:50 }} {% endautoescape %}
- {% if thread.get_last_replies %} + {% if thread.thread.get_last_replies %}
- {% for post in thread.get_last_replies %} - {% if thread.can_bump %} + {% for post in thread.thread.get_last_replies %} + {% if thread.bumpable %}
{% else %} -
+
{% endif %} {% if post.image %}
@@ -98,7 +98,7 @@ diff --git a/boards/views.py b/boards/views.py --- a/boards/views.py +++ b/boards/views.py @@ -36,7 +36,10 @@ def index(request, page=0): else: form = threadFormClass(error_class=PlainErrorList, **kwargs) - threads = Post.objects.get_threads(page=int(page)) + threads = [] + for thread in Post.objects.get_threads(page=int(page)): + threads.append({'thread': thread, + 'bumpable': thread.can_bump()}) context['threads'] = None if len(threads) == 0 else threads context['form'] = form