diff --git a/opentech/apply/determinations/views.py b/opentech/apply/determinations/views.py index af343d02e9cf901bf62c65069dcb5023ff6c4085..88e6e787de56761bb604412841a656b861fcd9c4 100644 --- a/opentech/apply/determinations/views.py +++ b/opentech/apply/determinations/views.py @@ -262,19 +262,21 @@ class DeterminationCreateOrUpdateView(CreateOrUpdateView): # We want to progress as normal so don't redirect through form return False else: - # Add a helpful message to prompt them to select the correct option - messages.warning( - request, - _('A determination of "{current}" exists but you tried to progress as "{target}"').format( - current=determination.get_outcome_display(), - target=action, + if request: + # Add a helpful message to prompt them to select the correct option + messages.warning( + request, + _('A determination of "{current}" exists but you tried to progress as "{target}"').format( + current=determination.get_outcome_display(), + target=action, + ) ) - ) if action in DETERMINATION_OUTCOMES: return HttpResponseRedirect(reverse_lazy( 'apply:submissions:determinations:form', - args=(submission.id,)) + "?action=" + action) + args=(submission.id,)) + "?action=" + action + ) @method_decorator(staff_required, name='dispatch') diff --git a/opentech/apply/funds/serializers.py b/opentech/apply/funds/serializers.py index da59d604d37d77946005695b7b9cea9dc3f4d2cc..5af0bb7fea8526eb4d7419f9c83b83cdc2429211 100644 --- a/opentech/apply/funds/serializers.py +++ b/opentech/apply/funds/serializers.py @@ -24,7 +24,10 @@ class ActionSerializer(serializers.Field): # determination matrix. try: redirect = DeterminationCreateOrUpdateView.should_redirect( - self.context['request'], instance, transition) + None, + instance, + transition, + ) except KeyError: redirect = None if redirect: