diff options
author | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2012-12-16 19:03:14 (GMT) |
---|---|---|
committer | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2012-12-16 19:03:14 (GMT) |
commit | 763d8a04a87ce110ead286f71a34142ccc8ff041 (patch) | |
tree | 4164d6accc4464fb6fa258d13a70e177a67cfb79 | |
parent | d05a248aa90ee1a1936dc86a9a7b5b2c827585e9 (diff) |
avoided case when len(ends) < len(starts).
-rw-r--r-- | program/models.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/program/models.py b/program/models.py index bac192c..8d415b8 100644 --- a/program/models.py +++ b/program/models.py @@ -228,10 +228,10 @@ class ProgramSlot(models.Model): byweekday=byweekday_end)) if not old: - for k in range(len(starts)): + for k in range(min(len(starts), len(ends))): timeslot = TimeSlot.objects.create(programslot=self, start=starts[k], end=ends[k]) elif self.until > old.until: - for k in range(len(starts)): + for k in range(min(len(starts), len(ends))): if starts[k].date() > old.until: timeslot = TimeSlot.objects.create(programslot=self, start=starts[k], end=ends[k]) |