--- /dev/null
+{% extends "tickets/base.html" %}
+
+{% block content %}
+<h1>Overzicht reserveringen</h1>
+<table>
+ <thead>
+ <tr><th>Voorstelling</th><th>Reserveringen</th><th>Betaald</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>
+{% endfor %}
+ </tbody>
+</table>
+
+{% for show, info in shows.items %}
+<h2>{{ show }}</h2>
+<table>
+ <thead>
+ <tr><th>#</th><th>Naam</th><th>Aantal kaarten</th><th>Betaling verwerkt op</th></tr>
+ </thead>
+ <tbody>
+ {% for b in info.bookings %}
+ <tr><td>{{ b.pk }}</td><td>{{ b.name }}</td><td>{{ b.tickets }}</td><td>{{ b.payment }}</td></tr>
+ {% endfor %}
+ </tbody>
+</table>
+{% endfor %}
+{% endblock %}
from django.template import RequestContext
from django.contrib.auth.decorators import permission_required
-from models import Booking, TICKET_PRICE
+from models import Booking, TICKET_PRICE, SHOW_CHOICES
class BookingForm(django.forms.ModelForm):
class Meta:
c['amount'] = sum([b.price for b in bookings])
return render_to_response('tickets/payments.html', c, context_instance=RequestContext(request))
+
+@permission_required('tickets.change_booking')
+def bookings(request):
+ shows = {}
+ for (show, show_desc) in SHOW_CHOICES:
+ shows[show_desc] = {
+ 'bookings' : Booking.objects.filter(show=show),
+ 'payed' : Booking.objects.filter(show=show, payment__isnull=False),
+ }
+
+ c = { 'shows' : shows }
+ return render_to_response('tickets/bookings.html', c, context_instance=RequestContext(request))
urlpatterns = patterns('',
(r'^$', 'dorestad-bookings.tickets.views.book'),
url(r'^betalingen/$', 'dorestad-bookings.tickets.views.payments', name='payments'),
+ url(r'^overzicht/$', 'dorestad-bookings.tickets.views.bookings', name='bookings'),
# Example:
# (r'^dorestad1493/', include('dorestad1493.foo.urls')),