From 763d8a04a87ce110ead286f71a34142ccc8ff041 Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Sun, 16 Dec 2012 20:03:14 +0100 Subject: avoided case when len(ends) < len(starts). 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]) -- cgit v0.10.2