From 6a0dda89cdfa17b44d48150412a0064304259d99 Mon Sep 17 00:00:00 2001 From: Patrick Date: Wed, 28 Oct 2020 00:22:42 +0000 Subject: [PATCH] update post view, limit related_posts to max 6 --- fet2020/posts/views.py | 2 +- fet2020/templates/layout.html | 8 ++++---- fet2020/templates/posts/show.html | 33 +++++++++++++++++-------------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/fet2020/posts/views.py b/fet2020/posts/views.py index 690c414f..eb5b7aba 100644 --- a/fet2020/posts/views.py +++ b/fet2020/posts/views.py @@ -91,7 +91,7 @@ def show(request, id=None): "post": p, "author_image": author_image, "next": get_next_dict(p), - "related_posts": p.tags.similar_objects(), + "related_posts": p.tags.similar_objects()[:6], "ep_agenda_link": ep_agenda_link, "ep_protocol_link": ep_protocol_link, } diff --git a/fet2020/templates/layout.html b/fet2020/templates/layout.html index e326fa12..53f2359a 100644 --- a/fet2020/templates/layout.html +++ b/fet2020/templates/layout.html @@ -76,14 +76,14 @@ footer {
-
+
- - - + + +
diff --git a/fet2020/templates/posts/show.html b/fet2020/templates/posts/show.html index e65d57cc..11af2ef3 100644 --- a/fet2020/templates/posts/show.html +++ b/fet2020/templates/posts/show.html @@ -34,12 +34,8 @@
-

{{ post.title|tags_to_url }}

- {{ post.subtitle|default_if_none:" "|tags_to_url }} -
-
+
-
{% for tag in post.get_tagnames %} {{ tag|tags_to_url }} {% endfor %} @@ -56,20 +52,27 @@
{% if request.user.is_authenticated %} - {% if post.has_agenda %} - Agenda
- {% endif %} + {% if post.has_agenda %} + Agenda
+ {% endif %} - {% if post.has_protocol %} - Protokoll - {% endif %} + {% if post.has_protocol %} + Protokoll
+ {% endif %} {% endif %} - Start: {{ post.event_start }}
- Ende: {{ post.event_end }}
- Nächster Artikel
- {% include 'posts/partials/_date_box.html' %} + {% if post.event_start %} + Start: {{ post.event_start }}
+ {% endif %} + {% if post.event_end %} + Ende: {{ post.event_end }}
+ {% endif %} + + Nächster Artikel
+ {% if post.event_start %} + {% include 'posts/partials/_date_box.html' %} + {% endif %}