diff --git a/src/registrar/config/settings.py b/src/registrar/config/settings.py index f1e331a0f..82755d6cf 100644 --- a/src/registrar/config/settings.py +++ b/src/registrar/config/settings.py @@ -90,8 +90,8 @@ INSTALLED_APPS = [ "widget_tweaks", # library for Finite State Machine statuses "django_fsm", - # library for phone numbers - "phonenumber_field", + # library for phone numbers + "phonenumber_field", # let's be sure to install our own application! "registrar", # Our internal API application @@ -183,7 +183,7 @@ TEMPLATES = [ }, ] -MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage' +MESSAGE_STORAGE = "django.contrib.messages.storage.session.SessionStorage" # IS_DEMO_SITE controls whether or not we show our big red "TEST SITE" banner # underneath the "this is a real government website" banner. @@ -301,7 +301,7 @@ USE_L10N = True USE_TZ = True # setting for phonenumber library -PHONENUMBER_DEFAULT_REGION="US" +PHONENUMBER_DEFAULT_REGION = "US" # endregion # region: Logging-----------------------------------------------------------### @@ -375,7 +375,7 @@ LOGGING = { # Django's template processor "django.template": { "handlers": ["console"], - "level": "DEBUG", + "level": "INFO", }, # Django's runserver "django.server": { @@ -386,13 +386,13 @@ LOGGING = { # Django's runserver requests "django.request": { "handlers": ["django.server"], - "level": "DEBUG", + "level": "INFO", "propagate": False, }, # OpenID Connect logger "oic": { "handlers": ["console"], - "level": "DEBUG", + "level": "INFO", }, # Django wrapper for OpenID Connect "djangooidc": { diff --git a/src/registrar/forms/application_wizard.py b/src/registrar/forms/application_wizard.py index ce241f897..a4a36cda2 100644 --- a/src/registrar/forms/application_wizard.py +++ b/src/registrar/forms/application_wizard.py @@ -10,10 +10,9 @@ from django import forms from django.shortcuts import render from django.contrib.auth.mixins import LoginRequiredMixin from django.urls import resolve -from django.core.validators import RegexValidator from formtools.wizard.views import NamedUrlSessionWizardView # type: ignore -from phonenumber_field.formfields import PhoneNumberField +from phonenumber_field.formfields import PhoneNumberField # type: ignore from registrar.models import Contact, DomainApplication, Domain @@ -238,7 +237,8 @@ class DotGovDomainForm(RegistrarForm): ) if not Domain.string_could_be_domain(requested + ".gov"): raise forms.ValidationError( - "Please enter a valid domain name using only letters, numbers, and hyphens", + "Please enter a valid domain name using only letters, " + "numbers, and hyphens", code="invalid", ) return requested diff --git a/src/registrar/migrations/0005_alter_contact_phone.py b/src/registrar/migrations/0006_alter_contact_phone.py similarity index 75% rename from src/registrar/migrations/0005_alter_contact_phone.py rename to src/registrar/migrations/0006_alter_contact_phone.py index 42bc4d889..c971a13d1 100644 --- a/src/registrar/migrations/0005_alter_contact_phone.py +++ b/src/registrar/migrations/0006_alter_contact_phone.py @@ -1,13 +1,13 @@ -# Generated by Django 4.1.4 on 2022-12-12 20:43 +# Generated by Django 4.1.4 on 2022-12-14 20:48 from django.db import migrations -import phonenumber_field.modelfields +import phonenumber_field.modelfields # type: ignore class Migration(migrations.Migration): dependencies = [ - ("registrar", "0004_domainapplication_federal_agency"), + ("registrar", "0005_domainapplication_city_and_more"), ] operations = [ diff --git a/src/registrar/models/contact.py b/src/registrar/models/contact.py index 374818800..0d3a7c389 100644 --- a/src/registrar/models/contact.py +++ b/src/registrar/models/contact.py @@ -1,6 +1,6 @@ from django.db import models -from phonenumber_field.modelfields import PhoneNumberField +from phonenumber_field.modelfields import PhoneNumberField # type: ignore class Contact(models.Model): diff --git a/src/registrar/templates/application_org_contact.html b/src/registrar/templates/application_org_contact.html index 6ed712954..82cf8d09c 100644 --- a/src/registrar/templates/application_org_contact.html +++ b/src/registrar/templates/application_org_contact.html @@ -34,11 +34,15 @@ {% input_with_errors wizard.form.address_line2 %} + {% input_with_errors wizard.form.city %} + {{ wizard.form.state_territory|add_label_class:"usa-label" }} {{ wizard.form.state_territory|add_class:"usa-select" }} {% input_with_errors wizard.form.zipcode add_class="usa-input--small" %} + {% input_with_errors wizard.form.urbanization %} + {{ block.super }} diff --git a/src/registrar/templates/includes/contact.html b/src/registrar/templates/includes/contact.html index 193de3187..68c243558 100644 --- a/src/registrar/templates/includes/contact.html +++ b/src/registrar/templates/includes/contact.html @@ -2,5 +2,5 @@ {{ contact.get_formatted_name }}
{% if contact.title %}{{ contact.title }}
{% endif %} {% if contact.email %}{{ contact.email }}
{% endif %} - {% if contact.phone %}{{ contact.phone }}{% endif %} - \ No newline at end of file + {% if contact.phone %}{{ contact.phone.as_national }}{% endif %} + diff --git a/src/registrar/templatetags/field_helpers.py b/src/registrar/templatetags/field_helpers.py index 99b02b48e..264ffbcb9 100644 --- a/src/registrar/templatetags/field_helpers.py +++ b/src/registrar/templatetags/field_helpers.py @@ -5,7 +5,7 @@ from django import template register = template.Library() -@register.inclusion_tag('includes/input_with_errors.html') +@register.inclusion_tag("includes/input_with_errors.html") def input_with_errors(field, add_class=None): """Make an input field along with error handling. diff --git a/src/registrar/tests/test_forms.py b/src/registrar/tests/test_forms.py index 86a2c5350..d20b4d56b 100644 --- a/src/registrar/tests/test_forms.py +++ b/src/registrar/tests/test_forms.py @@ -49,7 +49,8 @@ class TestFormValidation(TestCase): self.assertEqual( form.errors["requested_domain"], [ - "Please enter a valid domain name using only letters, numbers, and hyphens" + "Please enter a valid domain name using only letters, " + "numbers, and hyphens" ], ) @@ -105,14 +106,14 @@ class TestFormValidation(TestCase): """Requirements box unchecked is an error.""" form = RequirementsForm(data={}) self.assertEqual( - form.errors["is_policy_acknowledged"], ["You must read and agree to the .gov domain requirements to proceed."] + form.errors["is_policy_acknowledged"], + ["You must read and agree to the .gov domain requirements to proceed."], ) def test_requirements_form_unchecked(self): """Requirements box unchecked is an error.""" form = RequirementsForm(data={"is_policy_acknowledged": False}) self.assertEqual( - form.errors["is_policy_acknowledged"], ["You must read and agree to the .gov domain requirements to proceed."] + form.errors["is_policy_acknowledged"], + ["You must read and agree to the .gov domain requirements to proceed."], ) - - diff --git a/src/registrar/tests/test_views.py b/src/registrar/tests/test_views.py index 534cf4130..52fce8728 100644 --- a/src/registrar/tests/test_views.py +++ b/src/registrar/tests/test_views.py @@ -222,7 +222,7 @@ class DomainApplicationTests(TestWithUser, WebTest): ao_form["authorizing_official-last_name"] = "Tester ATO" ao_form["authorizing_official-title"] = "Chief Tester" ao_form["authorizing_official-email"] = "testy@town.com" - ao_form["authorizing_official-phone"] = "(555) 555 5555" + ao_form["authorizing_official-phone"] = "(201) 555 5555" # test saving the page self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) @@ -235,7 +235,7 @@ class DomainApplicationTests(TestWithUser, WebTest): self.assertEquals(application.authorizing_official.last_name, "Tester ATO") self.assertEquals(application.authorizing_official.title, "Chief Tester") self.assertEquals(application.authorizing_official.email, "testy@town.com") - self.assertEquals(application.authorizing_official.phone, "(555) 555 5555") + self.assertEquals(application.authorizing_official.phone, "(201) 555 5555") # test next button self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) @@ -328,7 +328,7 @@ class DomainApplicationTests(TestWithUser, WebTest): your_contact_form["your_contact-last_name"] = "Tester you" your_contact_form["your_contact-title"] = "Admin Tester" your_contact_form["your_contact-email"] = "testy-admin@town.com" - your_contact_form["your_contact-phone"] = "(555) 555 5556" + your_contact_form["your_contact-phone"] = "(201) 555 5556" # test saving the page self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) @@ -341,7 +341,7 @@ class DomainApplicationTests(TestWithUser, WebTest): self.assertEquals(application.submitter.last_name, "Tester you") self.assertEquals(application.submitter.title, "Admin Tester") self.assertEquals(application.submitter.email, "testy-admin@town.com") - self.assertEquals(application.submitter.phone, "(555) 555 5556") + self.assertEquals(application.submitter.phone, "(201) 555 5556") # test next button self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) @@ -360,7 +360,7 @@ class DomainApplicationTests(TestWithUser, WebTest): other_contacts_form["other_contacts-last_name"] = "Tester2" other_contacts_form["other_contacts-title"] = "Another Tester" other_contacts_form["other_contacts-email"] = "testy2@town.com" - other_contacts_form["other_contacts-phone"] = "(555) 555 5557" + other_contacts_form["other_contacts-phone"] = "(201) 555 5557" # test saving the page self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) @@ -375,7 +375,7 @@ class DomainApplicationTests(TestWithUser, WebTest): last_name="Tester2", title="Another Tester", email="testy2@town.com", - phone="(555) 555 5557", + phone="(201) 555 5557", ).count(), 1, ) @@ -482,7 +482,7 @@ class DomainApplicationTests(TestWithUser, WebTest): self.assertContains(review_page, "Tester ATO") self.assertContains(review_page, "Chief Tester") self.assertContains(review_page, "testy@town.com") - self.assertContains(review_page, "(555) 555 5555") + self.assertContains(review_page, "(201) 555-5555") self.assertContains(review_page, "city.com") self.assertContains(review_page, "city.gov") self.assertContains(review_page, "city1.gov") @@ -491,12 +491,12 @@ class DomainApplicationTests(TestWithUser, WebTest): self.assertContains(review_page, "Tester you") self.assertContains(review_page, "Admin Tester") self.assertContains(review_page, "testy-admin@town.com") - self.assertContains(review_page, "(555) 555 5556") + self.assertContains(review_page, "(201) 555-5556") self.assertContains(review_page, "Testy2") self.assertContains(review_page, "Tester2") self.assertContains(review_page, "Another Tester") self.assertContains(review_page, "testy2@town.com") - self.assertContains(review_page, "(555) 555 5557") + self.assertContains(review_page, "(201) 555-5557") self.assertContains(review_page, "security@city.com") self.assertContains(review_page, "Nothing else.")