# HG changeset patch # User Brian Neal # Date 1351212947 18000 # Node ID 3baba9165d38fba5b2df6916d874003f39dd27f4 # Parent fa58c0277e266b6b2d6807f91a78a1966a01b7f2 Don't display empty flyers div for the upcoming gigs tag. diff -r fa58c0277e26 -r 3baba9165d38 gigs/templatetags/gig_tags.py --- a/gigs/templatetags/gig_tags.py Thu Oct 25 19:37:19 2012 -0500 +++ b/gigs/templatetags/gig_tags.py Thu Oct 25 19:55:47 2012 -0500 @@ -19,4 +19,9 @@ 'flyer', 'venue', 'venue__city', 'venue__city__state', 'venue__city__country').order_by('date')[:10] - return {'gigs': gigs} + flyers = [gig.flyer for gig in gigs if gig.flyer] + + return { + 'gigs': gigs, + 'flyers': flyers + } diff -r fa58c0277e26 -r 3baba9165d38 madeira/templates/gigs/upcoming_gigs_tag.html --- a/madeira/templates/gigs/upcoming_gigs_tag.html Thu Oct 25 19:37:19 2012 -0500 +++ b/madeira/templates/gigs/upcoming_gigs_tag.html Thu Oct 25 19:55:47 2012 -0500 @@ -3,22 +3,22 @@

Upcoming Shows...

+{% if flyers %}
- {% for gig in gigs %} - {% if gig.flyer %} + {% for flyer in flyers %}
- - {{ gig.flyer.caption }} + + {{ flyer.caption }}
- {% endif %} {% endfor %}
+{% endif %}