mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-23 19:20:47 +02:00
Merge pull request #819 from cisagov/ab/394-session-bug-fix
Session bug fix
This commit is contained in:
commit
7209e74f41
2 changed files with 7 additions and 5 deletions
|
@ -145,7 +145,6 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
|||
# ---- TYPE PAGE ----
|
||||
type_form = type_page.form
|
||||
type_form["organization_type-organization_type"] = "federal"
|
||||
|
||||
# test next button and validate data
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
type_result = type_page.form.submit()
|
||||
|
@ -161,6 +160,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
|||
# ---- FEDERAL BRANCH PAGE ----
|
||||
# Follow the redirect to the next form page
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
federal_page = type_result.follow()
|
||||
federal_form = federal_page.form
|
||||
federal_form["organization_federal-federal_type"] = "executive"
|
||||
|
|
|
@ -67,7 +67,7 @@ class ApplicationWizard(TemplateView):
|
|||
URL_NAMESPACE = "application"
|
||||
# name for accessing /application/<id>/edit
|
||||
EDIT_URL_NAME = "edit-application"
|
||||
|
||||
NEW_URL_NAME = "/register/"
|
||||
# We need to pass our human-readable step titles as context to the templates.
|
||||
TITLES = {
|
||||
Step.ORGANIZATION_TYPE: _("Type of organization"),
|
||||
|
@ -144,6 +144,7 @@ class ApplicationWizard(TemplateView):
|
|||
self._application = DomainApplication.objects.create(
|
||||
creator=self.request.user, # type: ignore
|
||||
)
|
||||
|
||||
self.storage["application_id"] = self._application.id
|
||||
return self._application
|
||||
|
||||
|
@ -195,7 +196,6 @@ class ApplicationWizard(TemplateView):
|
|||
|
||||
def get(self, request, *args, **kwargs):
|
||||
"""This method handles GET requests."""
|
||||
|
||||
current_url = resolve(request.path_info).url_name
|
||||
|
||||
# if user visited via an "edit" url, associate the id of the
|
||||
|
@ -213,12 +213,15 @@ class ApplicationWizard(TemplateView):
|
|||
# send users "to the application wizard" without needing to
|
||||
# know which view is first in the list of steps.
|
||||
if self.__class__ == ApplicationWizard:
|
||||
# if starting a new application, clear the storage
|
||||
if request.path_info == self.NEW_URL_NAME:
|
||||
del self.storage
|
||||
|
||||
return self.goto(self.steps.first)
|
||||
|
||||
self.steps.current = current_url
|
||||
context = self.get_context_data()
|
||||
context["forms"] = self.get_forms()
|
||||
|
||||
return render(request, self.template_name, context)
|
||||
|
||||
def get_all_forms(self, **kwargs) -> list:
|
||||
|
@ -242,7 +245,6 @@ class ApplicationWizard(TemplateView):
|
|||
and from the database if `use_db` is True (provided that record exists).
|
||||
An empty form will be provided if neither of those are true.
|
||||
"""
|
||||
|
||||
kwargs = {
|
||||
"files": files,
|
||||
"prefix": self.steps.current,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue