diff options
author | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2011-10-16 12:56:31 (GMT) |
---|---|---|
committer | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2011-10-16 12:56:31 (GMT) |
commit | c4f7faf65485df31299e137fd4e2eb596b1c84be (patch) | |
tree | b7e02c5f70bc73c11669a1a763f4fda6bee036a3 | |
parent | a48129a20a177e6f9a81720e83137f682248bfa6 (diff) |
fixed save method for ProgramSlot.
-rw-r--r-- | program/models.py | 8 |
1 files changed, 4 insertions, 4 deletions
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)) |