From 7e3e8f37e2dd9388b8c6eeba02be1af6e7c57b6f Mon Sep 17 00:00:00 2001 From: FreneticScribbler Date: Mon, 13 Jan 2020 22:13:37 +0000 Subject: [PATCH] FIX: Do not display auth warnings when duplicating events Closes #326. --- RIGS/rigboard.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/RIGS/rigboard.py b/RIGS/rigboard.py index 99c80601..abb0ed9e 100644 --- a/RIGS/rigboard.py +++ b/RIGS/rigboard.py @@ -140,15 +140,18 @@ class EventUpdate(generic.UpdateView): if value is not None and value != '': context[field] = model.objects.get(pk=value) - # If this event has already been emailed to a client, show a warning - if self.object.auth_request_at is not None: - messages.info(self.request, 'This event has already been sent to the client for authorisation, any changes you make will be visible to them immediately.') - - if hasattr(self.object, 'authorised'): - messages.warning(self.request, 'This event has already been authorised by client, any changes to price will require reauthorisation.') - return context + def render_to_response(self, context, **response_kwargs): + if not hasattr(context, 'duplicate'): + # If this event has already been emailed to a client, show a warning + if self.object.auth_request_at is not None: + messages.info(self.request, 'This event has already been sent to the client for authorisation, any changes you make will be visible to them immediately.') + + if hasattr(self.object, 'authorised'): + messages.warning(self.request, 'This event has already been authorised by client, any changes to price will require reauthorisation.') + return super(EventUpdate, self).render_to_response(context, **response_kwargs) + def get_success_url(self): return reverse_lazy('event_detail', kwargs={'pk': self.object.pk})