annotate mysite/templates/band/gigs.html @ 28:a404f93a68d3

Decrease by 2 orders of magnitude the number of queries needed to generate the gigs page for the Madeira.
author Brian Neal <bgneal@gmail.com>
date Thu, 31 Mar 2011 00:14:34 +0000
parents efb2da0b5d10
children 903260593491
rev   line source
bgneal@1 1 {% extends 'band/base.html' %}
bgneal@26 2 {% load url from future %}
bgneal@1 3 {% block title %}The Madeira | Shows{% endblock %}
bgneal@1 4 {% block custom_css %}
bgneal@26 5 <link rel="stylesheet" href="{{ STATIC_URL }}js/fancybox/jquery.fancybox-1.3.1.css" type="text/css" media="screen" />
bgneal@1 6 {% endblock %}
bgneal@1 7 {% block custom_js %}
bgneal@18 8 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
bgneal@26 9 <script type="text/javascript" src="{{ STATIC_URL }}js/fancybox/jquery.fancybox-1.3.1.pack.js"></script>
bgneal@18 10 <script type="text/javascript">
bgneal@18 11 $(function() {
bgneal@18 12 $('a.fancybox').fancybox();
bgneal@18 13 });
bgneal@18 14 </script>
bgneal@1 15 {% endblock %}
bgneal@1 16 {% block content %}
bgneal@1 17 <h1>Show Dates</h1>
bgneal@1 18
bgneal@1 19 <h2>Upcoming Shows</h2>
bgneal@1 20 {% if upcoming %}
bgneal@1 21 {% for show in upcoming %}
bgneal@1 22 <p style="clear:both">
bgneal@1 23 {% if show.flyer %}
bgneal@18 24 <a href="{{ show.flyer.image.url }}" class="fancybox" rel="madeira-gallery">
bgneal@12 25 <!-- <img style="float:left; margin-right:5px; margin-bottom:1em" src="{{ show.flyer.get_thumbnail_url }}" -->
bgneal@12 26 <img class="left" src="{{ show.flyer.get_thumbnail_url }}"
bgneal@1 27 alt="{{ show.flyer.caption }}" title="{{ show.flyer.caption }}" /></a>
bgneal@1 28 {% endif %}
bgneal@1 29 <strong>{{ show.date|date:"F d, Y" }}</strong>
bgneal@1 30 {% if show.time %}{{ show.time|time:"h:i A" }}{% endif %}<br />
bgneal@1 31
bgneal@1 32 {% if show.title and show.url %}
bgneal@1 33 <a href="{{ show.url }}" target="_blank">{{ show.title }}</a><br />
bgneal@1 34 {% else %}
bgneal@1 35 {% if show.title %}
bgneal@1 36 {{ show.title }}<br />
bgneal@1 37 {% endif %}
bgneal@1 38 {% endif %}
bgneal@1 39
bgneal@1 40 {% if show.venue %}
bgneal@1 41 {% if show.venue.url %}
bgneal@1 42 <a href="{{ show.venue.url }}" target="_blank">{{ show.venue.name }}</a>,
bgneal@1 43 {% else %}
bgneal@1 44 {{ show.venue }},
bgneal@1 45 {% endif %}
bgneal@1 46 {% if show.venue.address %}
bgneal@1 47 {{ show.venue.address }},
bgneal@1 48 {% endif %}
bgneal@1 49 {% if show.venue.city.state %}
bgneal@1 50 {{ show.venue.city.name }}, {{ show.venue.city.state.name }}
bgneal@1 51 {% else %}
bgneal@1 52 {{ show.venue.city.name }}
bgneal@1 53 {% endif %}
bgneal@5 54 {% ifnotequal show.venue.city.country.name "USA" %}
bgneal@5 55 {{ show.venue.city.country.name }}
bgneal@5 56 {% endifnotequal %}
bgneal@1 57 <br />
bgneal@1 58 {% if show.venue.phone %}
bgneal@1 59 {{ show.venue.phone }}
bgneal@1 60 <br />
bgneal@1 61 {% endif %}
bgneal@1 62 {% endif %}
bgneal@1 63
bgneal@28 64 {% if show.bands_ %}
bgneal@1 65 With:
bgneal@28 66 {% for band in show.bands_ %}
bgneal@1 67 {% if band.url %}
bgneal@1 68 <a href="{{ band.url }}" target="_blank">{{ band.name }}</a>
bgneal@1 69 {% else %}
bgneal@1 70 {{ band.name }}
bgneal@1 71 {% endif %}
bgneal@1 72 {% if not forloop.last %}
bgneal@1 73 &bull;
bgneal@1 74 {% endif %}
bgneal@1 75 {% endfor %}
bgneal@1 76 <br />
bgneal@1 77 {% endif %}
bgneal@1 78
bgneal@1 79 {% if show.notes %}
bgneal@1 80 {{ show.notes|safe }}
bgneal@1 81 {% endif %}
bgneal@1 82 </p>
bgneal@1 83 {% endfor %}
bgneal@1 84 {% else %}
bgneal@1 85 None at this time.
bgneal@1 86 {% endif %}
bgneal@1 87 <br clear="all" />
bgneal@1 88
bgneal@1 89 {% if flyerGigs %}
bgneal@1 90 <div class="thumb-box">
bgneal@1 91 <h2>Flyers</h2>
bgneal@21 92 <div style="width:90%; margin-left:auto;">
bgneal@1 93 {% for gig in flyerGigs %}
bgneal@21 94 <div style="display:inline-table;">
bgneal@1 95 <table class="image-table">
bgneal@1 96 <caption>{{ gig.venue.name}}, {{ gig.date|date:"F 'y" }}</caption>
bgneal@1 97 <tr><td>
bgneal@18 98 <a href="{{ gig.flyer.image.url }}" class="fancybox" rel="madeira-gallery">
bgneal@1 99 <img src="{{ gig.flyer.get_thumbnail_url }}" alt="{{ gig.date|date:"F d, Y" }}" title="{{ gig.date|date:"F d, Y" }}" /></a>
bgneal@1 100 </td></tr>
bgneal@1 101 </table>
bgneal@21 102 </div>
bgneal@1 103 {% endfor %}
bgneal@21 104 </div>
bgneal@1 105 <div clear="all"></div>
bgneal@26 106 <center><p>To see all our flyers in full size, check out our <a href="{% url 'band.views.flyers' %}">show flyer gallery</a>.</p></center>
bgneal@1 107 </div>
bgneal@1 108 {% endif %}
bgneal@1 109
bgneal@1 110 {% if previous %}
bgneal@1 111 <h2>Previous Shows</h2>
bgneal@1 112 <center>
bgneal@1 113 <table border="0" cellpadding="3" cellspacing="3" width="95%">
bgneal@1 114 <tr><th width="20%" align="center">Date</th><th width="40%" align="center">Venue</th><th width="40%" align="center">Bands</th></tr>
bgneal@1 115 {% for show in previous %}
bgneal@1 116 <tr>
bgneal@1 117 <td width="20%">{{ show.date|date:"M d, Y" }}</td>
bgneal@1 118 <td width="40%">
bgneal@1 119 {% if show.title and show.url %}
bgneal@1 120 <a href="{{ show.url }}" target="_blank">{{ show.title }}</a>,
bgneal@1 121 {% else %}
bgneal@1 122 {% if show.title %}
bgneal@1 123 {{ show.title }},
bgneal@1 124 {% endif %}
bgneal@1 125 {% endif %}
bgneal@1 126 {% if show.venue.url %}
bgneal@1 127 <a href="{{ show.venue.url }}" target="_blank">{{ show.venue.name }}</a>,
bgneal@1 128 {% else %}
bgneal@1 129 {{ show.venue.name }},
bgneal@1 130 {% endif %}
bgneal@1 131 {{ show.venue.city.name }}, {{ show.venue.city.state.abbrev }}
bgneal@5 132 {% ifnotequal show.venue.city.country.name "USA" %}
bgneal@5 133 {{ show.venue.city.country.name }}
bgneal@5 134 {% endifnotequal %}
bgneal@1 135 </td>
bgneal@1 136 <td width="40%">
bgneal@28 137 {% for band in show.bands_ %}
bgneal@1 138 {% if band.url %}
bgneal@1 139 <a href="{{ band.url }}" target="_blank">{{ band.name }}</a>
bgneal@1 140 {% else %}
bgneal@1 141 {{ band.name }}
bgneal@1 142 {% endif %}
bgneal@1 143 {% if not forloop.last %}
bgneal@1 144 &bull;
bgneal@1 145 {% endif %}
bgneal@1 146 {% endfor %}
bgneal@1 147 </td>
bgneal@1 148 </tr>
bgneal@1 149 {% endfor %}
bgneal@1 150 </table>
bgneal@1 151 </center>
bgneal@1 152 {% endif %}
bgneal@1 153
bgneal@1 154 {% if stats %}
bgneal@1 155 <h2>Past Show Statistics</h2>
bgneal@1 156 <table border="0" cellpadding="3" cellspacing="3">
bgneal@1 157 <tr><th align="left">Number of shows:</th><td>{{ stats.count }}</td></tr>
bgneal@1 158 <tr><th align="left">Number of unique venues:</th><td>{{ stats.venues }}</td></tr>
bgneal@1 159 <tr><th align="left">Number of unique cities:</th><td>{{ stats.cities }}</td></tr>
bgneal@1 160 <tr><th align="left">Number of unique states:</th><td>{{ stats.states }}</td></tr>
bgneal@5 161 <tr><th align="left">Number of unique countries:</th><td>{{ stats.countries }}</td></tr>
bgneal@1 162 <tr><th align="left">Number of unique bands:</th><td>{{ stats.bands }}</td></tr>
bgneal@1 163 </table>
bgneal@1 164 {% endif %}
bgneal@1 165
bgneal@1 166 {% endblock %}