From: Guillaume Pellerin Date: Tue, 17 May 2016 14:19:28 +0000 (+0200) Subject: fix multiple events X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=687682e0327d23be5816f06dc14d98202346f803;p=mezzo.git fix multiple events --- diff --git a/app/festival/templates/festival/artist_detail.html b/app/festival/templates/festival/artist_detail.html index 24b27d6b..5e1087c2 100644 --- a/app/festival/templates/festival/artist_detail.html +++ b/app/festival/templates/festival/artist_detail.html @@ -27,7 +27,7 @@

{% trans "Also discover" %}


- {% for event in artist.events.all %} + {% for event in artist.events.all|no_parents %} {% include 'agenda/includes/event_card.html' %} {% endfor %} {% for video in artist.videos.all %} diff --git a/app/festival/templatetags/festival_tags.py b/app/festival/templatetags/festival_tags.py index ac7eeadb..092d31bc 100644 --- a/app/festival/templatetags/festival_tags.py +++ b/app/festival/templatetags/festival_tags.py @@ -61,3 +61,7 @@ def unique_posts(events): if not post in post_list: post_list.append(post) return post_list + +@register.filter +def no_parents(events): + return events.filter(parent=None) diff --git a/app/templates/blog/blog_post_detail.html b/app/templates/blog/blog_post_detail.html index a433abb6..d052deee 100644 --- a/app/templates/blog/blog_post_detail.html +++ b/app/templates/blog/blog_post_detail.html @@ -1,5 +1,5 @@ {% extends "blog/blog_post_list.html" %} -{% load mezzanine_tags comment_tags keyword_tags rating_tags i18n disqus_tags %} +{% load mezzanine_tags comment_tags keyword_tags rating_tags i18n disqus_tags festival_tags %} {% block meta_title %}{{ blog_post.meta_title }}{% endblock %} @@ -123,7 +123,7 @@ {% for post in related_posts %} {% include 'blog/includes/post_card.html' %} {% endfor %} - {% for event in blog_post.events.all %} + {% for event in blog_post.events.all|no_parents %} {% for artist in event.artists.all %} {% include "festival/inc/artist_card.html" %} {% endfor %}