This commit is contained in:
CocoByte 2023-12-29 02:16:39 -07:00
parent 0fea0c2f94
commit ea043bf504
No known key found for this signature in database
GPG key ID: BBFAA2526384C97F
2 changed files with 3 additions and 9 deletions

View file

@ -9,7 +9,6 @@ from django.core.validators import RegexValidator, MaxLengthValidator
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from api.views import DOMAIN_API_MESSAGES from api.views import DOMAIN_API_MESSAGES
from registrar.management.commands.utility.terminal_helper import TerminalColors
from registrar.models import Contact, DomainApplication, DraftDomain, Domain from registrar.models import Contact, DomainApplication, DraftDomain, Domain
from registrar.templatetags.url_helpers import public_site_url from registrar.templatetags.url_helpers import public_site_url
@ -586,7 +585,6 @@ class OtherContactsForm(RegistrarForm):
error_messages={"required": "Enter a phone number for this contact."}, error_messages={"required": "Enter a phone number for this contact."},
) )
# Override clean in order to correct validation logic # Override clean in order to correct validation logic
def clean(self): def clean(self):
# NOTE: using self.cleaned_data directly apparently causes a CORS error # NOTE: using self.cleaned_data directly apparently causes a CORS error
@ -597,13 +595,12 @@ class OtherContactsForm(RegistrarForm):
# I have spent hours tyring to figure out why, but have no idea... # I have spent hours tyring to figure out why, but have no idea...
# so for now we will grab their values from the raw data... # so for now we will grab their values from the raw data...
for i in self.data: for i in self.data:
if 'phone' in i or 'email' in i: if "phone" in i or "email" in i:
# check if it has data # check if it has data
field_value = self.data.get(i) field_value = self.data.get(i)
# update the bool on whether the form is actually empty # update the bool on whether the form is actually empty
form_is_empty = field_value == "" or field_value is None form_is_empty = field_value == "" or field_value is None
if form_is_empty: if form_is_empty:
# clear any errors raised by the form fields # clear any errors raised by the form fields
# (before this clean() method is run, each field # (before this clean() method is run, each field
@ -616,7 +613,6 @@ class OtherContactsForm(RegistrarForm):
if field in self.errors: if field in self.errors:
del self.errors[field] del self.errors[field]
return cleaned return cleaned

View file

@ -785,7 +785,6 @@ class DomainApplicationTests(TestWithUser, WebTest):
other_contacts_form = other_contacts_page.forms[0] other_contacts_form = other_contacts_page.forms[0]
# Minimal check to ensure the form is loaded with data (if this part of # Minimal check to ensure the form is loaded with data (if this part of
# the application doesn't work, we should be equipped with other unit # the application doesn't work, we should be equipped with other unit
# tests to flag it) # tests to flag it)
@ -799,7 +798,6 @@ class DomainApplicationTests(TestWithUser, WebTest):
other_contacts_form["other_contacts-0-email"] = "" other_contacts_form["other_contacts-0-email"] = ""
other_contacts_form["other_contacts-0-phone"] = "" other_contacts_form["other_contacts-0-phone"] = ""
# Submit the now empty form # Submit the now empty form
result = other_contacts_form.submit() result = other_contacts_form.submit()
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)