From 463e0b7055b99fd98f7fbe78dfcea16bfcc79edb Mon Sep 17 00:00:00 2001
From: Skia
Date: Wed, 31 May 2017 00:41:39 +0200
Subject: [PATCH] Again some small forum improvements
Signed-off-by: Skia
---
forum/templates/forum/last_unread.jinja | 6 ++++--
forum/templates/forum/macros.jinja | 14 +++++++++++---
forum/views.py | 6 ++++--
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/forum/templates/forum/last_unread.jinja b/forum/templates/forum/last_unread.jinja
index 7489db2b..83bcffb0 100644
--- a/forum/templates/forum/last_unread.jinja
+++ b/forum/templates/forum/last_unread.jinja
@@ -6,9 +6,10 @@
{% endblock %}
{% block content %}
-
+
Forum >
-
+
+
{% trans %}Forum{% endtrans %}
{% trans %}Last unread messages{% endtrans %}
@@ -26,6 +27,7 @@
{% endfor %}
+
{% endblock %}
diff --git a/forum/templates/forum/macros.jinja b/forum/templates/forum/macros.jinja
index 159a1cbf..59e13196 100644
--- a/forum/templates/forum/macros.jinja
+++ b/forum/templates/forum/macros.jinja
@@ -99,8 +99,18 @@
diff --git a/forum/views.py b/forum/views.py
index 89374e36..f2f1aec0 100644
--- a/forum/views.py
+++ b/forum/views.py
@@ -67,7 +67,8 @@ class ForumLastUnread(ListView):
topic_list = self.model.objects.filter(_last_message__date__gt=self.request.user.forum_infos.last_read_date)\
.exclude(_last_message__readers=self.request.user)\
.order_by('-_last_message__date')\
- .select_related('_last_message__author__avatar_pict')
+ .select_related('_last_message__author', 'author')\
+ .prefetch_related('forum__edit_groups')
return topic_list
class ForumForm(forms.ModelForm):
@@ -122,7 +123,8 @@ class ForumDetailView(CanViewMixin, DetailView):
def get_context_data(self, **kwargs):
kwargs = super(ForumDetailView, self).get_context_data(**kwargs)
- qs = self.object.topics.order_by('-_last_message__date').select_related('_last_message__author', 'author')\
+ qs = self.object.topics.order_by('-_last_message__date')\
+ .select_related('_last_message__author', 'author')\
.prefetch_related("forum__edit_groups")
paginator = Paginator(qs,
settings.SITH_FORUM_PAGE_LENGTH)