<tr><th>Voorstelling</th><th>Reserveringen</th><th>Gereserveerde kaarten</th><th>Betaalde kaarten</th></tr>
</thead>
<tbody>
-{% for show, info in shows.items %}
+{% for show, info in shows %}
<tr><td>{{ show }}</td><td>{{ info.bookings|length }}</td><td>{{ info.tickets }}</td><td>{{ info.payed|length }}</td></tr>
{% endfor %}
</tbody>
</table>
-{% for show, info in shows.items %}
+{% for show, info in shows %}
<h2>{{ show }}</h2>
<table>
<thead>
@permission_required('tickets.change_booking')
def bookings(request):
- shows = {}
+ shows = []
for (show, show_desc) in SHOW_CHOICES:
bookings = Booking.objects.filter(show=show)
- shows[show_desc] = {
+ # shows is a list of (show_desc, infodict) tuples
+ shows.append((show_desc, {
'bookings' : bookings,
'tickets' : sum([b.tickets for b in bookings]),
'payed' : Booking.objects.filter(show=show, payment__isnull=False),
- }
+ }))
c = { 'shows' : shows }
return render_to_response('tickets/bookings.html', c, context_instance=RequestContext(request))