mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-03 08:22:18 +02:00
linted
This commit is contained in:
parent
195d3287f3
commit
f0af949783
1 changed files with 3 additions and 11 deletions
|
@ -108,6 +108,8 @@ class UserProfileView(UserProfilePermissionView, FormMixin):
|
|||
"""If the form is invalid, conditionally display an additional error."""
|
||||
if hasattr(self.user, "finished_setup") and not self.user.finished_setup:
|
||||
messages.error(self.request, "Before you can manage your domain, we need you to add contact information.")
|
||||
form.initial["redirect"] = form.data.get("redirect")
|
||||
logger.info(form.initial)
|
||||
return super().form_invalid(form)
|
||||
|
||||
def form_valid(self, form):
|
||||
|
@ -119,17 +121,7 @@ class UserProfileView(UserProfilePermissionView, FormMixin):
|
|||
# superclass has the redirect
|
||||
return super().form_valid(form)
|
||||
|
||||
def form_invalid(self, form):
|
||||
"""If the form is invalid, conditionally display an additional error."""
|
||||
if hasattr(self.user, "finished_setup") and not self.user.finished_setup:
|
||||
messages.error(self.request, "Before you can manage your domain, we need you to add contact information.")
|
||||
logger.info("got here, now rendering response")
|
||||
form.initial['redirect'] = form.data.get('redirect')
|
||||
logger.info(form.initial)
|
||||
return super().form_invalid(form)
|
||||
|
||||
def get_object(self, queryset=None):
|
||||
|
||||
"""Override get_object to return the logged-in user's contact"""
|
||||
self.user = self.request.user # get the logged in user
|
||||
if hasattr(self.user, "contact"): # Check if the user has a contact instance
|
||||
|
@ -190,4 +182,4 @@ class FinishProfileSetupView(UserProfileView):
|
|||
return reverse(redirect_param)
|
||||
except NoReverseMatch as err:
|
||||
logger.error(f"get_redirect_url -> Could not find the specified page. Err: {err}")
|
||||
return super().get_success_url()
|
||||
return super().get_success_url()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue