Again some small forum improvements

Signed-off-by: Skia <skia@libskia.so>
This commit is contained in:
Skia 2017-05-31 00:41:39 +02:00
parent 136d0f3fa0
commit 463e0b7055
3 changed files with 19 additions and 7 deletions

View File

@ -6,9 +6,10 @@
{% endblock %}
{% block content %}
<p>
<p>
<a href="{{ url('forum:main') }}">Forum</a> >
</p>
</p>
<div id="forum">
<h3>{% trans %}Forum{% endtrans %}</h3>
<h4>{% trans %}Last unread messages{% endtrans %}</h4>
<p>
@ -26,6 +27,7 @@
</span>
{% endfor %}
</p>
</div>
{% endblock %}

View File

@ -99,8 +99,18 @@
</div>
<div class="msg_content {% if m.deleted %}deleted{% endif %}" {% if m.id == first_unread_message_id %}id="first_unread"{% endif %}>
<div class="msg_header">
<div class="ib w_big title">{{ m.title }}</div>
<div class="ib w_big title">
<a href="{{ m.get_absolute_url() }}">
{{ m.date|localtime|date(DATETIME_FORMAT) }}
{{ m.date|localtime|time(DATETIME_FORMAT) }}
{%- if m.title -%}
- {{ m.title }}
{%- endif -%}
</a>
</div>
<div class="ib w_small">
<span><a href="{{ m.get_absolute_url() }}">#{{ m.id }}</a></span>
<br/>
<span><a href="{{ url('forum:new_message', topic_id=m.topic.id) }}?quote_id={{ m.id }}">
{% trans %}Reply as quote{% endtrans %}</a></span>
{% if user.can_edit(m) %}
@ -113,8 +123,6 @@
<span> <a href="{{ url('forum:delete_message', message_id=m.id) }}">{% trans %}Delete{% endtrans %}</a></span>
{% endif %}
{% endif %}
<br/>
<span>{{ m.date|localtime|date(DATETIME_FORMAT) }} {{ m.date|localtime|time(DATETIME_FORMAT) }}</span>
</div>
</div>
<hr>

View File

@ -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)