From c74bc945b6b3b6798e7ef67f3acd448537dd40a8 Mon Sep 17 00:00:00 2001 From: Johnathan Graydon Date: Mon, 26 Mar 2018 14:00:08 +0100 Subject: [PATCH] Not error if no person Will close #330 --- RIGS/signals.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RIGS/signals.py b/RIGS/signals.py index 19909f6f..d7e36ccf 100644 --- a/RIGS/signals.py +++ b/RIGS/signals.py @@ -50,8 +50,10 @@ def send_eventauthorisation_success_email(instance): 'object': instance, } - if instance.email == instance.event.person.email: + if instance.event.person is not None and instance.email == instance.event.person.email: context['to_name'] = instance.event.person.name + elif instance.event.organisation is not None and instance.email == instance.event.organisation.email: + context['to_name'] = instance.event.organisation.name subject = "N%05d | %s - Event Authorised" % (instance.event.pk, instance.event.name)