From 5432c07efb42da0aa2500ae882fdea1b600af9bd Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Wed, 25 Jan 2017 23:48:37 +0100 Subject: [PATCH] skip checking if this is a new speaker --- program/signal_handlers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/program/signal_handlers.py b/program/signal_handlers.py index cb4be252..c65dd4ca 100644 --- a/program/signal_handlers.py +++ b/program/signal_handlers.py @@ -10,7 +10,8 @@ def check_speaker_event_camp_consistency(sender, instance, **kwargs): raise ValidationError({'events': 'One or more events belong to a different camp (%s) than the speaker (%s) does' % (event.camp, instance.camp)}) def check_speaker_camp_change(sender, instance, **kwargs): - for event in instance.events.all(): - if event.camp != instance.camp: - raise ValidationError({'camp': 'You cannot change the camp a speaker belongs to if the speaker is associated with one or more events.'}) + if instance.pk: + for event in instance.events.all(): + if event.camp != instance.camp: + raise ValidationError({'camp': 'You cannot change the camp a speaker belongs to if the speaker is associated with one or more events.'})