diff options
author | Christian Pointner <equinox@spreadspace.org> | 2012-02-15 22:06:22 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2012-02-15 22:06:22 (GMT) |
commit | 6463c08c83fea3c744ca5bfdd31699bffd118e4f (patch) | |
tree | 1d06a213a32452ddf35388331f794625b15b596d /program | |
parent | 55b2560b6180addea5d8b16e4dd4f80314fd7e09 (diff) |
only show active program_slots at show_detail
Diffstat (limited to 'program')
-rw-r--r-- | program/models.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/program/models.py b/program/models.py index 0b78347..9197837 100644 --- a/program/models.py +++ b/program/models.py @@ -239,6 +239,12 @@ class ProgramSlot(models.Model): return self.timeslots.count() timeslot_count.description = _("Time slot count") + def has_active_timeslot(self): + start = self.timeslots.all().order_by("start")[0].start + end = self.timeslots.all().order_by("-end")[0].end + now = datetime.now() + return (start < now and end > now) + class TimeSlotManager(models.Manager): def get_or_create_current(self): try: |