mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-18 10:29:23 +02:00
Merge branch 'main' into es/2162-delete-submitter-v2
This commit is contained in:
commit
5c32a1922b
47 changed files with 1694 additions and 273 deletions
|
@ -148,7 +148,14 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
except DomainRequest.DoesNotExist:
|
||||
logger.debug("DomainRequest id %s did not have a DomainRequest" % id)
|
||||
|
||||
self._domain_request = DomainRequest.objects.create(creator=self.request.user)
|
||||
# If a user is creating a request, we assume that perms are handled upstream
|
||||
if self.request.user.is_org_user(self.request):
|
||||
self._domain_request = DomainRequest.objects.create(
|
||||
creator=self.request.user,
|
||||
portfolio=self.request.session.get("portfolio"),
|
||||
)
|
||||
else:
|
||||
self._domain_request = DomainRequest.objects.create(creator=self.request.user)
|
||||
|
||||
self.storage["domain_request_id"] = self._domain_request.id
|
||||
return self._domain_request
|
||||
|
@ -390,6 +397,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>"
|
||||
|
@ -406,6 +417,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
You’ll 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>'
|
||||
|
@ -421,6 +433,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
|
||||
|
||||
|
@ -497,7 +510,11 @@ 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()
|
||||
|
||||
|
@ -757,7 +774,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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue