From c4f7faf65485df31299e137fd4e2eb596b1c84be Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Sun, 16 Oct 2011 14:56:31 +0200 Subject: fixed save method for ProgramSlot. diff --git a/program/models.py b/program/models.py index 89bf8f8..eed5ac1 100644 --- a/program/models.py +++ b/program/models.py @@ -182,9 +182,9 @@ class ProgramSlot(models.Model): return u'%s, %s, %s - %s' % (weekday, self.rrule, tstart, tend) def save(self, *args, **kwargs): - super(ProgramSlot, self).save(*args, **kwargs) - if not self.pk: + super(ProgramSlot, self).save(*args, **kwargs) + if self.rrule.freq == 0: byweekday_start = None byweekday_end = None @@ -249,8 +249,8 @@ class TimeSlotManager(models.Manager): new_programslot.save() except ValidationError: pass - - return new_programslot.timeslots.all()[0] + else: + return new_programslot.timeslots.all()[0] def get_day_timeslots(self, day): today = datetime.combine(day, time(6,0)) -- cgit v0.10.2