From: Matthijs Kooijman Date: Mon, 25 Oct 2010 09:17:41 +0000 (+0200) Subject: tickets: List number of booked tickets in the overview. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=02d8f6dc92f570d1016c139b0ec0fb742fe66d7b;p=matthijs%2Fprojects%2Fdorestad-bookings.git tickets: List number of booked tickets in the overview. Previously, only the number of bookings was shown. --- diff --git a/tickets/templates/tickets/bookings.html b/tickets/templates/tickets/bookings.html index ae2d6a9..26d0018 100644 --- a/tickets/templates/tickets/bookings.html +++ b/tickets/templates/tickets/bookings.html @@ -4,11 +4,11 @@

Overzicht reserveringen

- + {% for show, info in shows.items %} - + {% endfor %}
VoorstellingReserveringenBetaald
VoorstellingReserveringenGereserveerde kaartenBetaalde kaarten
{{ show }}{{ info.bookings|length }}{{ info.payed|length }}
{{ show }}{{ info.bookings|length }}{{ info.tickets }}{{ info.payed|length }}
diff --git a/tickets/views.py b/tickets/views.py index 4eca48d..db988fe 100644 --- a/tickets/views.py +++ b/tickets/views.py @@ -132,8 +132,10 @@ def payments(request): def bookings(request): shows = {} for (show, show_desc) in SHOW_CHOICES: + bookings = Booking.objects.filter(show=show) shows[show_desc] = { - 'bookings' : Booking.objects.filter(show=show), + 'bookings' : bookings, + 'tickets' : sum([b.tickets for b in bookings]), 'payed' : Booking.objects.filter(show=show, payment__isnull=False), }