tickets: Add a Bookings.__unicode__() method.
authorMatthijs Kooijman <matthijs@stdin.nl>
Tue, 19 Oct 2010 13:03:15 +0000 (15:03 +0200)
committerMatthijs Kooijman <matthijs@stdin.nl>
Tue, 19 Oct 2010 13:03:15 +0000 (15:03 +0200)
tickets/models.py

index 5c56b0aa82b0d99f2ef88e79215c77f43270e613..3229020872d4afd33f531b80fbaab2e7fe7cbca2 100644 (file)
@@ -26,3 +26,10 @@ class Booking(models.Model):
     def _get_price(self):
         return self.tickets * TICKET_PRICE
     price = property(_get_price)
+
+    def __unicode__(self):
+        return u'#%s: %s - %s - %s kaart%s (€ %.2d)' % (
+            self.pk, self.name,
+            self.get_show_display(),
+            self.tickets, "en" if self.tickets != 1 else "",
+            self.price)