Finishing or canceling a request redirects to domain request view

This commit is contained in:
zandercymatics 2024-09-05 13:16:38 -06:00
parent 2939c89e0d
commit 3c3fd26b93
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
3 changed files with 57 additions and 17 deletions

View file

@ -402,6 +402,10 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
def get_context_data(self):
"""Define context for access on all wizard pages."""
requested_domain_name = None
if self.domain_request.requested_domain is not None:
requested_domain_name = self.domain_request.requested_domain.name
context_stuff = {}
if DomainRequest._form_complete(self.domain_request, self.request):
modal_button = '<button type="submit" ' 'class="usa-button" ' ">Submit request</button>"
@ -418,6 +422,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
Youll only be able to withdraw your request.",
"review_form_is_complete": True,
"user": self.request.user,
"requested_domain__name": requested_domain_name,
}
else: # form is not complete
modal_button = '<button type="button" class="usa-button" data-close-modal>Return to request</button>'
@ -433,6 +438,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
Return to the request and visit the steps that are marked as "incomplete."',
"review_form_is_complete": False,
"user": self.request.user,
"requested_domain__name": requested_domain_name,
}
return context_stuff
@ -512,7 +518,10 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
# if user opted to save progress and return,
# return them to the home page
if button == "save_and_return":
return HttpResponseRedirect(reverse("home"))
if request.user.is_org_user(request):
return HttpResponseRedirect(reverse("domain-requests"))
else:
return HttpResponseRedirect(reverse("home"))
# otherwise, proceed as normal
return self.goto_next_step()
@ -781,7 +790,10 @@ class DomainRequestWithdrawn(DomainRequestPermissionWithdrawView):
domain_request = DomainRequest.objects.get(id=self.kwargs["pk"])
domain_request.withdraw()
domain_request.save()
return HttpResponseRedirect(reverse("home"))
if self.request.user.is_org_user(self.request):
return HttpResponseRedirect(reverse("domain-requests"))
else:
return HttpResponseRedirect(reverse("home"))
class DomainRequestDeleteView(DomainRequestPermissionDeleteView):