Mercurial > public > madeira
changeset 80:3baba9165d38
Don't display empty flyers div for the upcoming gigs tag.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 25 Oct 2012 19:55:47 -0500 |
parents | fa58c0277e26 |
children | fc9616b1c7ae |
files | gigs/templatetags/gig_tags.py madeira/templates/gigs/upcoming_gigs_tag.html |
diffstat | 2 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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 + }
--- 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 @@ <div class="center-block"> <h2>Upcoming Shows...</h2> +{% if flyers %} <div class="thumb-box"> <div style="width:90%; margin-left:auto;"> - {% for gig in gigs %} - {% if gig.flyer %} + {% for flyer in flyers %} <div style="display:inline-table;"> <table class="image-table"> <tr><td> - <a href="{{ gig.flyer.image.url }}" class="fancybox" rel="madeira-gallery"> - <img src="{{ gig.flyer.get_thumbnail_url }}" alt="{{ gig.flyer.caption }}" title="{{ gig.flyer.caption }}" /></a> + <a href="{{ flyer.image.url }}" class="fancybox" rel="madeira-gallery"> + <img src="{{ flyer.get_thumbnail_url }}" alt="{{ flyer.caption }}" title="{{ flyer.caption }}" /></a> </td></tr> </table> </div> - {% endif %} {% endfor %} </div> </div> +{% endif %} <ul> {% for gig in gigs %}