summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2016-05-01 13:48:38 (GMT)
committerErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2016-05-01 13:48:38 (GMT)
commitb96eecc7b8d67ba51b3c3683b80b2cf64b7378e6 (patch)
treef3cf684c075fa1f3846910671b85903bfd831596 /program
parent18d04533b13fc19267e73e7cd20fe9223b96286a (diff)
be explicit about what is not allowed to change while updating.
Diffstat (limited to 'program')
-rw-r--r--program/models.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/program/models.py b/program/models.py
index d755248..c3bc468 100644
--- a/program/models.py
+++ b/program/models.py
@@ -336,14 +336,20 @@ class ProgramSlot(models.Model):
def save(self, *args, **kwargs):
if self.pk:
old = ProgramSlot.objects.get(pk=self.pk)
- if self.rrule != old.rrule \
- or self.byweekday != old.byweekday \
- or self.show != old.show \
- or self.dstart != old.dstart \
- or self.tstart != old.tstart \
- or self.tend != old.tend \
- or self.is_repetition != old.is_repetition:
- raise ValidationError(u"only until can be changed")
+ if self.rrule != old.rrule:
+ raise ValidationError(u"Recurrence rule cannot ba changed")
+ if self.byweekday != old.byweekday:
+ raise ValidationError(u"Weekday cannot be changed")
+ if self.show != old.show:
+ raise ValidationError(u"Show cannot be changed")
+ if self.dstart != old.dstart:
+ raise ValidationError(u"First date cannot ba changed")
+ if self.tstart != old.tstart:
+ raise ValidationError(u"Start time cannot be changed")
+ if self.tend != old.tend:
+ raise ValidationError(u"End time cannot be changed")
+ if self.is_repetition != old.is_repetition:
+ raise ValidationError(u"Is repetition cannot be changed")
else:
old = False