From 597ee0373ef111751a54458206bac644d4227a8a Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Mon, 22 Dec 2014 14:29:28 +0100 Subject: [PATCH] Add Booking model --- booking/models.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/booking/models.py b/booking/models.py index 3a4febf..2dbba09 100644 --- a/booking/models.py +++ b/booking/models.py @@ -40,6 +40,7 @@ class Duck(models.Model): donated_at = models.DateTimeField(default = timezone.now) adopted_by = models.ForeignKey(User, related_name = 'adopted_ducks', null = True) adopted_at = models.DateTimeField(null = True) + bookings = models.ManyToManyField(User, through = 'Booking', related_name = '+') on_holiday_since = models.DateTimeField(null = True) on_holiday_until = models.DateTimeField(null = True) @@ -59,3 +60,13 @@ class DuckCompetence(models.Model): class Meta: unique_together = ('duck', 'comp') + +class Booking(models.Model): + """Duck booking governor table""" + + duck = models.ForeignKey(Duck) + user = models.ForeignKey(User) + comp_req = models.ForeignKey(Competence) + start_ts = models.DateTimeField(default = timezone.now) + end_ts = models.DateTimeField(null = True, blank = True) + successful = models.BooleanField(default = True)