From b02ea665d8ecce3b326dc0b245027a0ce4c2de29 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Mon, 19 Oct 2020 10:21:03 +0100 Subject: fixed failing test --- ctrack/register/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ctrack/register/views.py') diff --git a/ctrack/register/views.py b/ctrack/register/views.py index db018b2..b601c49 100644 --- a/ctrack/register/views.py +++ b/ctrack/register/views.py @@ -78,8 +78,12 @@ class SingleDateTimeEventCreate(FormView): success_url = reverse_lazy("organisations:list") def get_success_url(self): - self.success_url = reverse_lazy("organisations:detail", args=[self.kwargs["org_slug"]]) - return super().get_success_url() + # We might not have org_slug if we are not setting this from an org detail page + try: + self.success_url = reverse_lazy("organisations:detail", args=[self.kwargs["org_slug"]]) + return super().get_success_url() + except KeyError: + return super().get_success_url() def get_context_data(self, **kwargs): context = super().get_context_data() -- cgit v1.2.3