tickets: List number of booked tickets in the overview.
authorMatthijs Kooijman <matthijs@stdin.nl>
Mon, 25 Oct 2010 09:17:41 +0000 (11:17 +0200)
committerMatthijs Kooijman <matthijs@stdin.nl>
Mon, 25 Oct 2010 09:17:41 +0000 (11:17 +0200)
Previously, only the number of bookings was shown.

tickets/templates/tickets/bookings.html
tickets/views.py

index ae2d6a912281d0db915f49f5e8b3640170926247..26d0018ffd7e540056684fcffa960ad12e93ae76 100644 (file)
@@ -4,11 +4,11 @@
 <h1>Overzicht reserveringen</h1>
 <table>
     <thead>
-       <tr><th>Voorstelling</th><th>Reserveringen</th><th>Betaald</th></tr>
+       <tr><th>Voorstelling</th><th>Reserveringen</th><th>Gereserveerde kaarten</th><th>Betaalde kaarten</th></tr>
     </thead>
     <tbody>
 {% for show, info in shows.items %}
-<tr><td>{{ show }}</td><td>{{ info.bookings|length }}</td><td>{{ info.payed|length }}</td></tr>
+<tr><td>{{ show }}</td><td>{{ info.bookings|length }}</td><td>{{ info.tickets }}</td><td>{{ info.payed|length }}</td></tr>
 {% endfor %}
     </tbody>
 </table>
index 4eca48d94739342c8a0e87e5cc33931aa936152d..db988fe448a280ea34d99839741b3c3ff509b133 100644 (file)
@@ -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),
         }