tickets: Show number of payed tickets instead of reservations.
[matthijs/projects/dorestad-bookings.git] / tickets / views.py
index db988fe448a280ea34d99839741b3c3ff509b133..1764301de977e2ba7824748cb7a1ddc3cee9aa0f 100644 (file)
@@ -130,14 +130,15 @@ def payments(request):
 
 @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),
-        }
+            'payed'    : sum([b.tickets for b in bookings if b.payment is not None]),
+        }))
 
     c = { 'shows' : shows }
     return render_to_response('tickets/bookings.html', c, context_instance=RequestContext(request))