From fc353a1ff6a724ace531b23ab3cb8398e7eb41ad Mon Sep 17 00:00:00 2001 From: Seamus Johnston Date: Fri, 9 Dec 2022 13:14:58 -0600 Subject: [PATCH 1/4] Update organization address fields --- src/registrar/forms/application_wizard.py | 10 +- .../0005_domainapplication_city_and_more.py | 23 ++++ src/registrar/models/domain_application.py | 129 ++++++++++-------- .../templates/application_org_contact.html | 4 + src/registrar/tests/test_views.py | 6 + 5 files changed, 112 insertions(+), 60 deletions(-) create mode 100644 src/registrar/migrations/0005_domainapplication_city_and_more.py diff --git a/src/registrar/forms/application_wizard.py b/src/registrar/forms/application_wizard.py index 0975b6810..f442df6a7 100644 --- a/src/registrar/forms/application_wizard.py +++ b/src/registrar/forms/application_wizard.py @@ -79,17 +79,19 @@ class OrganizationContactForm(RegistrarForm): required=False, choices=DomainApplication.AGENCY_CHOICES, ) - organization_name = forms.CharField(label="Organization name") - address_line1 = forms.CharField(label="Address line 1") + organization_name = forms.CharField(label="Organization Name") + address_line1 = forms.CharField(label="Street address") address_line2 = forms.CharField( required=False, - label="Address line 2", + label="Street address line 2", ) + city = forms.CharField(label="City") state_territory = forms.ChoiceField( - label="State/territory", + label="State, territory, or military post", choices=[("", "--Select--")] + DomainApplication.StateTerritoryChoices.choices, ) zipcode = forms.CharField(label="ZIP code") + urbanization = forms.CharField(label="Urbanization (Puerto Rico only)") class AuthorizingOfficialForm(RegistrarForm): diff --git a/src/registrar/migrations/0005_domainapplication_city_and_more.py b/src/registrar/migrations/0005_domainapplication_city_and_more.py new file mode 100644 index 000000000..367794e2a --- /dev/null +++ b/src/registrar/migrations/0005_domainapplication_city_and_more.py @@ -0,0 +1,23 @@ +# Generated by Django 4.1.3 on 2022-12-09 19:27 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("registrar", "0004_domainapplication_federal_agency"), + ] + + operations = [ + migrations.AddField( + model_name="domainapplication", + name="city", + field=models.TextField(blank=True, help_text="City", null=True), + ), + migrations.AddField( + model_name="domainapplication", + name="urbanization", + field=models.TextField(blank=True, help_text="Urbanization", null=True), + ), + ] diff --git a/src/registrar/models/domain_application.py b/src/registrar/models/domain_application.py index f9332fae7..1f8fe5683 100644 --- a/src/registrar/models/domain_application.py +++ b/src/registrar/models/domain_application.py @@ -28,62 +28,69 @@ class DomainApplication(TimeStampedModel): ] class StateTerritoryChoices(models.TextChoices): - ALABAMA = "AL", "Alabama" - ALASKA = "AK", "Alaska" - ARIZONA = "AZ", "Arizona" - ARKANSAS = "AR", "Arkansas" - CALIFORNIA = "CA", "California" - COLORADO = "CO", "Colorado" - CONNECTICUT = "CT", "Connecticut" - DELAWARE = "DE", "Delaware" - DISTRICT_OF_COLUMBIA = "DC", "District of Columbia" - FLORIDA = "FL", "Florida" - GEORGIA = "GA", "Georgia" - HAWAII = "HI", "Hawaii" - IDAHO = "ID", "Idaho" - ILLINOIS = "IL", "Illinois" - INDIANA = "IN", "Indiana" - IOWA = "IA", "Iowa" - KANSAS = "KS", "Kansas" - KENTUCKY = "KY", "Kentucky" - LOUISIANA = "LA", "Louisiana" - MAINE = "ME", "Maine" - MARYLAND = "MD", "Maryland" - MASSACHUSETTS = "MA", "Massachusetts" - MICHIGAN = "MI", "Michigan" - MINNESOTA = "MN", "Minnesota" - MISSISSIPPI = "MS", "Mississippi" - MISSOURI = "MO", "Missouri" - MONTANA = "MT", "Montana" - NEBRASKA = "NE", "Nebraska" - NEVADA = "NV", "Nevada" - NEW_HAMPSHIRE = "NH", "New Hampshire" - NEW_JERSEY = "NJ", "New Jersey" - NEW_MEXICO = "NM", "New Mexico" - NEW_YORK = "NY", "New York" - NORTH_CAROLINA = "NC", "North Carolina" - NORTH_DAKOTA = "ND", "North Dakota" - OHIO = "OH", "Ohio" - OKLAHOMA = "OK", "Oklahoma" - OREGON = "OR", "Oregon" - PENNSYLVANIA = "PA", "Pennsylvania" - RHODE_ISLAND = "RI", "Rhode Island" - SOUTH_CAROLINA = "SC", "South Carolina" - SOUTH_DAKOTA = "SD", "South Dakota" - TENNESSEE = "TN", "Tennessee" - TEXAS = "TX", "Texas" - UTAH = "UT", "Utah" - VERMONT = "VT", "Vermont" - VIRGINIA = "VA", "Virginia" - WASHINGTON = "WA", "Washington" - WEST_VIRGINIA = "WV", "West Virginia" - WISCONSIN = "WI", "Wisconsin" - WYOMING = "WY", "Wyoming" - AMERICAN_SAMOA = "AS", "American Samoa" - GUAM = "GU", "Guam" - NORTHERN_MARIANA_ISLANDS = "MP", "Northern Mariana Islands" - PUERTO_RICO = "PR", "Puerto Rico" - VIRGIN_ISLANDS = "VI", "Virgin Islands" + ALABAMA = "AL", "Alabama (AL)" + ALASKA = "AK", "Alaska (AK)" + AMERICAN_SAMOA = "AS", "American Samoa (AS)" + ARIZONA = "AZ", "Arizona (AZ)" + ARKANSAS = "AR", "Arkansas (AR)" + CALIFORNIA = "CA", "California (CA)" + COLORADO = "CO", "Colorado (CO)" + CONNECTICUT = "CT", "Connecticut (CT)" + DELAWARE = "DE", "Delaware (DE)" + DISTRICT_OF_COLUMBIA = "DC", "District of Columbia (DC)" + FLORIDA = "FL", "Florida (FL)" + GEORGIA = "GA", "Georgia (GA)" + GUAM = "GU", "Guam (GU)" + HAWAII = "HI", "Hawaii (HI)" + IDAHO = "ID", "Idaho (ID)" + ILLINOIS = "IL", "Illinois (IL)" + INDIANA = "IN", "Indiana (IN)" + IOWA = "IA", "Iowa (IA)" + KANSAS = "KS", "Kansas (KS)" + KENTUCKY = "KY", "Kentucky (KY)" + LOUISIANA = "LA", "Louisiana (LA)" + MAINE = "ME", "Maine (ME)" + MARYLAND = "MD", "Maryland (MD)" + MASSACHUSETTS = "MA", "Massachusetts (MA)" + MICHIGAN = "MI", "Michigan (MI)" + MINNESOTA = "MN", "Minnesota (MN)" + MISSISSIPPI = "MS", "Mississippi (MS)" + MISSOURI = "MO", "Missouri (MO)" + MONTANA = "MT", "Montana (MT)" + NEBRASKA = "NE", "Nebraska (NE)" + NEVADA = "NV", "Nevada (NV)" + NEW_HAMPSHIRE = "NH", "New Hampshire (NH)" + NEW_JERSEY = "NJ", "New Jersey (NJ)" + NEW_MEXICO = "NM", "New Mexico (NM)" + NEW_YORK = "NY", "New York (NY)" + NORTH_CAROLINA = "NC", "North Carolina (NC)" + NORTH_DAKOTA = "ND", "North Dakota (ND)" + NORTHERN_MARIANA_ISLANDS = "MP", "Northern Mariana Islands (MP)" + OHIO = "OH", "Ohio (OH)" + OKLAHOMA = "OK", "Oklahoma (OK)" + OREGON = "OR", "Oregon (OR)" + PENNSYLVANIA = "PA", "Pennsylvania (PA)" + PUERTO_RICO = "PR", "Puerto Rico (PR)" + RHODE_ISLAND = "RI", "Rhode Island (RI)" + SOUTH_CAROLINA = "SC", "South Carolina (SC)" + SOUTH_DAKOTA = "SD", "South Dakota (SD)" + TENNESSEE = "TN", "Tennessee (TN)" + TEXAS = "TX", "Texas (TX)" + UNITED_STATES_MINOR_OUTLYING_ISLANDS = ( + "UM", + "United States Minor Outlying Islands (UM)", + ) + UTAH = "UT", "Utah (UT)" + VERMONT = "VT", "Vermont (VT)" + VIRGIN_ISLANDS = "VI", "Virgin Islands (VI)" + VIRGINIA = "VA", "Virginia (VA)" + WASHINGTON = "WA", "Washington (WA)" + WEST_VIRGINIA = "WV", "West Virginia (WV)" + WISCONSIN = "WI", "Wisconsin (WI)" + WYOMING = "WY", "Wyoming (WY)" + ARMED_FORCES_AA = "AA", "Armed Forces Americas (AA)" + ARMED_FORCES_AE = "AE", "Armed Forces Africa, Canada, Europe, Middle East (AE)" + ARMED_FORCES_AP = "AP", "Armed Forces Pacific (AP)" class OrganizationChoices(models.TextChoices): FEDERAL = "federal", "Federal: a federal agency" @@ -315,6 +322,11 @@ class DomainApplication(TimeStampedModel): blank=True, help_text="Address line 2", ) + city = models.TextField( + null=True, + blank=True, + help_text="City", + ) state_territory = models.CharField( max_length=2, null=True, @@ -328,6 +340,11 @@ class DomainApplication(TimeStampedModel): help_text="ZIP code", db_index=True, ) + urbanization = models.TextField( + null=True, + blank=True, + help_text="Urbanization", + ) authorizing_official = models.ForeignKey( "registrar.Contact", diff --git a/src/registrar/templates/application_org_contact.html b/src/registrar/templates/application_org_contact.html index 3d105ac50..c34dba486 100644 --- a/src/registrar/templates/application_org_contact.html +++ b/src/registrar/templates/application_org_contact.html @@ -34,10 +34,14 @@ {{ wizard.form.address_line1|add_class:"usa-input" }} {{ wizard.form.address_line2|add_label_class:"usa-label" }} {{ wizard.form.address_line2|add_class:"usa-input" }} + {{ wizard.form.city|add_label_class:"usa-label" }} + {{ wizard.form.city|add_class:"usa-input" }} {{ wizard.form.state_territory|add_label_class:"usa-label" }} {{ wizard.form.state_territory|add_class:"usa-select" }} {{ wizard.form.zipcode|add_label_class:"usa-label" }} {{ wizard.form.zipcode|add_class:"usa-input usa-input--small" }} + {{ wizard.form.urbanization|add_label_class:"usa-label" }} + {{ wizard.form.urbanization|add_class:"usa-input usa-input--small" }} diff --git a/src/registrar/tests/test_views.py b/src/registrar/tests/test_views.py index 5a0ec93df..8e051d30b 100644 --- a/src/registrar/tests/test_views.py +++ b/src/registrar/tests/test_views.py @@ -183,8 +183,11 @@ class DomainApplicationTests(TestWithUser, WebTest): org_contact_form = org_contact_page.form org_contact_form["organization_contact-organization_name"] = "Testorg" org_contact_form["organization_contact-address_line1"] = "address 1" + org_contact_form["organization_contact-address_line2"] = "address 2" + org_contact_form["organization_contact-city"] = "NYC" org_contact_form["organization_contact-state_territory"] = "NY" org_contact_form["organization_contact-zipcode"] = "10002" + org_contact_form["organization_contact-urbanization"] = "URB Royal Oaks" # test saving the page self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) @@ -195,8 +198,11 @@ class DomainApplicationTests(TestWithUser, WebTest): application = DomainApplication.objects.get() # there's only one self.assertEquals(application.organization_name, "Testorg") self.assertEquals(application.address_line1, "address 1") + self.assertEquals(application.address_line2, "address 2") + self.assertEquals(application.city, "NYC") self.assertEquals(application.state_territory, "NY") self.assertEquals(application.zipcode, "10002") + self.assertEquals(application.urbanization, "URB Royal Oaks") # test next button self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) From 6fe6e23368b1901d56034d4fa3b55153ac362e84 Mon Sep 17 00:00:00 2001 From: Seamus Johnston Date: Mon, 12 Dec 2022 10:07:41 -0600 Subject: [PATCH 2/4] Include real info in app review page --- src/registrar/forms/application_wizard.py | 24 +++---- ..._alter_domainapplication_federal_agency.py | 20 ++++++ src/registrar/models/contact.py | 7 +- src/registrar/models/domain_application.py | 2 +- .../templates/application_review.html | 67 +++++++++++++++++-- src/registrar/templates/includes/contact.html | 6 ++ .../includes/organization_address.html | 25 +++++++ src/registrar/tests/test_views.py | 49 +++++++++++--- 8 files changed, 169 insertions(+), 31 deletions(-) create mode 100644 src/registrar/migrations/0006_alter_domainapplication_federal_agency.py create mode 100644 src/registrar/templates/includes/contact.html create mode 100644 src/registrar/templates/includes/organization_address.html diff --git a/src/registrar/forms/application_wizard.py b/src/registrar/forms/application_wizard.py index f442df6a7..ff40ad3e4 100644 --- a/src/registrar/forms/application_wizard.py +++ b/src/registrar/forms/application_wizard.py @@ -417,6 +417,10 @@ class ApplicationWizard(LoginRequiredMixin, NamedUrlSessionWizardView): context["form_titles"] = TITLES if self.steps.current == Step.ORGANIZATION_CONTACT: context["is_federal"] = self._is_federal() + if self.steps.current == Step.REVIEW: + context["step_cls"] = Step + application = self.get_application_object() + context["application"] = application return context def get_application_object(self) -> DomainApplication: @@ -439,9 +443,7 @@ class ApplicationWizard(LoginRequiredMixin, NamedUrlSessionWizardView): self.storage.extra_data["application_id"] = application.id return application - def forms_to_database( - self, forms: dict = None, form: RegistrarForm = None - ) -> DomainApplication: + def form_to_database(self, form: RegistrarForm) -> DomainApplication: """ Unpack the form responses onto the model object properties. @@ -449,16 +451,8 @@ class ApplicationWizard(LoginRequiredMixin, NamedUrlSessionWizardView): """ application = self.get_application_object() - if forms: - itr = forms - elif form: - itr = {"form": form} - else: - raise TypeError("forms and form cannot both be None") - - for form in itr.values(): - if form is not None and hasattr(form, "to_database"): - form.to_database(application) + if form is not None and hasattr(form, "to_database"): + form.to_database(application) return application @@ -469,7 +463,7 @@ class ApplicationWizard(LoginRequiredMixin, NamedUrlSessionWizardView): Do not manipulate the form data here. """ # save progress - self.forms_to_database(form=form) + self.form_to_database(form=form) return self.get_form_step_data(form) def get_form(self, step=None, data=None, files=None): @@ -509,7 +503,7 @@ class ApplicationWizard(LoginRequiredMixin, NamedUrlSessionWizardView): def done(self, form_list, form_dict, **kwargs): """Called when the data for every form is submitted and validated.""" - application = self.forms_to_database(forms=form_dict) + application = self.get_application_object() application.submit() # change the status to submitted application.save() logger.debug("Application object saved: %s", application.id) diff --git a/src/registrar/migrations/0006_alter_domainapplication_federal_agency.py b/src/registrar/migrations/0006_alter_domainapplication_federal_agency.py new file mode 100644 index 000000000..a214b4666 --- /dev/null +++ b/src/registrar/migrations/0006_alter_domainapplication_federal_agency.py @@ -0,0 +1,20 @@ +# Generated by Django 4.1.3 on 2022-12-12 14:48 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("registrar", "0005_domainapplication_city_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="domainapplication", + name="federal_agency", + field=models.TextField( + blank=True, help_text="Top level federal agency", null=True + ), + ), + ] diff --git a/src/registrar/models/contact.py b/src/registrar/models/contact.py index 01cdcc769..6368a0101 100644 --- a/src/registrar/models/contact.py +++ b/src/registrar/models/contact.py @@ -40,9 +40,14 @@ class Contact(models.Model): db_index=True, ) + def get_formatted_name(self): + """Returns the contact's name in Western order.""" + names = [n for n in [self.first_name, self.middle_name, self.last_name] if n] + return " ".join(names) if names else "Unknown" + def __str__(self): if self.first_name or self.last_name: - return f"{self.title or ''} {self.first_name or ''} {self.last_name or ''}" + return self.get_formatted_name() elif self.email: return self.email elif self.pk: diff --git a/src/registrar/models/domain_application.py b/src/registrar/models/domain_application.py index 1f8fe5683..110f4fac2 100644 --- a/src/registrar/models/domain_application.py +++ b/src/registrar/models/domain_application.py @@ -287,7 +287,7 @@ class DomainApplication(TimeStampedModel): federal_agency = models.TextField( null=True, - blank=False, + blank=True, help_text="Top level federal agency", ) diff --git a/src/registrar/templates/application_review.html b/src/registrar/templates/application_review.html index c4ac67c6e..1be19cade 100644 --- a/src/registrar/templates/application_review.html +++ b/src/registrar/templates/application_review.html @@ -8,14 +8,69 @@ {{ wizard.management_form }} {% csrf_token %} - {% for this_step in wizard.steps.all|slice:":-1" %} + {% for step in wizard.steps.all|slice:":-1" %}
- {{ form_titles|get_item:this_step }} - Edit -
-
- <Answer value> +
+
{{ form_titles|get_item:step }}
+
+ {% if step == step_cls.ORGANIZATION_TYPE %} + {{ application.get_organization_type_display }} + {% endif %} + {% if step == step_cls.ORGANIZATION_FEDERAL %} + {{ application.get_federal_type_display }} + {% endif %} + {% if step == step_cls.ORGANIZATION_ELECTION %} + {{ application.is_election_board|yesno:"Yes,No,Maybe" }} + {% endif %} + {% if step == step_cls.ORGANIZATION_CONTACT %} + {% include "includes/organization_address.html" with organization=application %} + {% endif %} + {% if step == step_cls.AUTHORIZING_OFFICIAL %} + {% include "includes/contact.html" with contact=application.authorizing_official %} + {% endif %} + {% if step == step_cls.CURRENT_SITES %} +
    + {% for site in application.current_websites.all %} +
  • {{ site.website }}
  • + {% empty %} +
  • None
  • + {% endfor %} +
+ {% endif %} + {% if step == step_cls.DOTGOV_DOMAIN %} +
    +
  • {{ application.requested_domain.name }}
  • + {% for site in application.alternative_domains.all %} +
  • {{ site.website }}
  • + {% endfor %} +
+ {% endif %} + {% if step == step_cls.PURPOSE %} + {{ application.purpose }} + {% endif %} + {% if step == step_cls.YOUR_CONTACT %} + {% include "includes/contact.html" with contact=application.submitter %} + {% endif %} + {% if step == step_cls.OTHER_CONTACTS %} + {% for other in application.other_contacts.all %} + {% include "includes/contact.html" with contact=other %} + {% empty %} + None + {% endfor %} + {% endif %} + {% if step == step_cls.SECURITY_EMAIL %} + {{ application.security_email }} + {% endif %} + {% if step == step_cls.ANYTHING_ELSE %} + {{ application.anything_else }} + {% endif %} +
+
+ Edit {{ form_titles|get_item:step }}
{% endfor %} diff --git a/src/registrar/templates/includes/contact.html b/src/registrar/templates/includes/contact.html new file mode 100644 index 000000000..193de3187 --- /dev/null +++ b/src/registrar/templates/includes/contact.html @@ -0,0 +1,6 @@ +
+ {{ 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 diff --git a/src/registrar/templates/includes/organization_address.html b/src/registrar/templates/includes/organization_address.html new file mode 100644 index 000000000..52f0d437a --- /dev/null +++ b/src/registrar/templates/includes/organization_address.html @@ -0,0 +1,25 @@ +
+ {% if organization.organization_name %} + {{ organization.organization_name }} + {% endif %} + {% if organization.address_line1 %} +
{{ organization.address_line1 }} + {% endif %} + {% if organization.address_line2 %} +
{{ organization.address_line2 }} + {% endif %} + {% if organization.city %} +
{{ organization.city }}{% if organization.state_territory %},  + {% else %}
+ {% endif %} + {% endif %} + {% if organization.state_territory %} + {{ organization.state_territory }} + {% endif %} + {% if organization.zipcode %} +
{{ organization.zipcode }} + {% endif %} + {% if organization.urbanization %} +
{{ organization.urbanization }} + {% endif %} +
\ No newline at end of file diff --git a/src/registrar/tests/test_views.py b/src/registrar/tests/test_views.py index 8e051d30b..534cf4130 100644 --- a/src/registrar/tests/test_views.py +++ b/src/registrar/tests/test_views.py @@ -218,8 +218,8 @@ class DomainApplicationTests(TestWithUser, WebTest): # Follow the redirect to the next form page ao_page = org_contact_result.follow() ao_form = ao_page.form - ao_form["authorizing_official-first_name"] = "Testy" - ao_form["authorizing_official-last_name"] = "Tester" + ao_form["authorizing_official-first_name"] = "Testy ATO" + 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" @@ -231,8 +231,8 @@ class DomainApplicationTests(TestWithUser, WebTest): self.assertEquals(result["Location"], "/register/authorizing_official/") # should see results in db application = DomainApplication.objects.get() # there's only one - self.assertEquals(application.authorizing_official.first_name, "Testy") - self.assertEquals(application.authorizing_official.last_name, "Tester") + self.assertEquals(application.authorizing_official.first_name, "Testy ATO") + 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") @@ -300,7 +300,7 @@ class DomainApplicationTests(TestWithUser, WebTest): # Follow the redirect to the next form page purpose_page = dotgov_result.follow() purpose_form = purpose_page.form - purpose_form["purpose-purpose"] = "Purpose of the site" + purpose_form["purpose-purpose"] = "For all kinds of things." # test saving the page self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) @@ -309,7 +309,7 @@ class DomainApplicationTests(TestWithUser, WebTest): self.assertEquals(result["Location"], "/register/purpose/") # should see results in db application = DomainApplication.objects.get() # there's only one - self.assertEquals(application.purpose, "Purpose of the site") + self.assertEquals(application.purpose, "For all kinds of things.") # test next button self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) @@ -419,7 +419,7 @@ class DomainApplicationTests(TestWithUser, WebTest): anything_else_page = security_email_result.follow() anything_else_form = anything_else_page.form - anything_else_form["anything_else-anything_else"] = "No" + anything_else_form["anything_else-anything_else"] = "Nothing else." # test saving the page self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) @@ -428,7 +428,7 @@ class DomainApplicationTests(TestWithUser, WebTest): self.assertEquals(result["Location"], "/register/anything_else/") # should see results in db application = DomainApplication.objects.get() # there's only one - self.assertEquals(application.anything_else, "No") + self.assertEquals(application.anything_else, "Nothing else.") # test next button self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) @@ -464,9 +464,42 @@ class DomainApplicationTests(TestWithUser, WebTest): # ---- REVIEW AND FINSIHED PAGES ---- # Follow the redirect to the next form page + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) review_page = requirements_result.follow() review_form = review_page.form + # Review page contains all the previously entered data + self.assertContains(review_page, "Federal") + self.assertContains(review_page, "Executive") + self.assertContains(review_page, "Testorg") + self.assertContains(review_page, "address 1") + self.assertContains(review_page, "address 2") + self.assertContains(review_page, "NYC") + self.assertContains(review_page, "NY") + self.assertContains(review_page, "10002") + self.assertContains(review_page, "URB Royal Oaks") + self.assertContains(review_page, "Testy ATO") + 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, "city.com") + self.assertContains(review_page, "city.gov") + self.assertContains(review_page, "city1.gov") + self.assertContains(review_page, "For all kinds of things.") + self.assertContains(review_page, "Testy you") + 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, "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, "security@city.com") + self.assertContains(review_page, "Nothing else.") + # test saving the page self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) result = review_page.form.submit("submit_button", value="save") From e6852274ed334a277a2146f545cca52f1d1a518b Mon Sep 17 00:00:00 2001 From: Seamus Johnston Date: Tue, 13 Dec 2022 16:01:57 -0600 Subject: [PATCH 3/4] Address PR feedback --- src/registrar/forms/application_wizard.py | 5 ++- .../0005_domainapplication_city_and_more.py | 9 ++++- ..._alter_domainapplication_federal_agency.py | 20 ----------- .../templates/application_review.html | 36 +++++++++++++------ 4 files changed, 38 insertions(+), 32 deletions(-) delete mode 100644 src/registrar/migrations/0006_alter_domainapplication_federal_agency.py diff --git a/src/registrar/forms/application_wizard.py b/src/registrar/forms/application_wizard.py index ff40ad3e4..56d62ce2b 100644 --- a/src/registrar/forms/application_wizard.py +++ b/src/registrar/forms/application_wizard.py @@ -91,7 +91,10 @@ class OrganizationContactForm(RegistrarForm): choices=[("", "--Select--")] + DomainApplication.StateTerritoryChoices.choices, ) zipcode = forms.CharField(label="ZIP code") - urbanization = forms.CharField(label="Urbanization (Puerto Rico only)") + urbanization = forms.CharField( + required=False, + label="Urbanization (Puerto Rico only)", + ) class AuthorizingOfficialForm(RegistrarForm): diff --git a/src/registrar/migrations/0005_domainapplication_city_and_more.py b/src/registrar/migrations/0005_domainapplication_city_and_more.py index 367794e2a..ea5d6b57f 100644 --- a/src/registrar/migrations/0005_domainapplication_city_and_more.py +++ b/src/registrar/migrations/0005_domainapplication_city_and_more.py @@ -1,4 +1,4 @@ -# Generated by Django 4.1.3 on 2022-12-09 19:27 +# Generated by Django 4.1.3 on 2022-12-12 21:00 from django.db import migrations, models @@ -20,4 +20,11 @@ class Migration(migrations.Migration): name="urbanization", field=models.TextField(blank=True, help_text="Urbanization", null=True), ), + migrations.AlterField( + model_name="domainapplication", + name="federal_agency", + field=models.TextField( + blank=True, help_text="Top level federal agency", null=True + ), + ), ] diff --git a/src/registrar/migrations/0006_alter_domainapplication_federal_agency.py b/src/registrar/migrations/0006_alter_domainapplication_federal_agency.py deleted file mode 100644 index a214b4666..000000000 --- a/src/registrar/migrations/0006_alter_domainapplication_federal_agency.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-12 14:48 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ("registrar", "0005_domainapplication_city_and_more"), - ] - - operations = [ - migrations.AlterField( - model_name="domainapplication", - name="federal_agency", - field=models.TextField( - blank=True, help_text="Top level federal agency", null=True - ), - ), - ] diff --git a/src/registrar/templates/application_review.html b/src/registrar/templates/application_review.html index 1be19cade..33ac78921 100644 --- a/src/registrar/templates/application_review.html +++ b/src/registrar/templates/application_review.html @@ -9,25 +9,34 @@ {% csrf_token %} {% for step in wizard.steps.all|slice:":-1" %} -
+
+
{{ form_titles|get_item:step }}
{% if step == step_cls.ORGANIZATION_TYPE %} - {{ application.get_organization_type_display }} + {{ application.get_organization_type_display|default:"Incomplete" }} {% endif %} {% if step == step_cls.ORGANIZATION_FEDERAL %} - {{ application.get_federal_type_display }} + {{ application.get_federal_type_display|default:"Incomplete" }} {% endif %} {% if step == step_cls.ORGANIZATION_ELECTION %} - {{ application.is_election_board|yesno:"Yes,No,Maybe" }} + {{ application.is_election_board|yesno:"Yes,No,Incomplete" }} {% endif %} {% if step == step_cls.ORGANIZATION_CONTACT %} + {% if organization.organization_name %} {% include "includes/organization_address.html" with organization=application %} + {% else %} + Incomplete + {% endif %} {% endif %} {% if step == step_cls.AUTHORIZING_OFFICIAL %} + {% if application.authorizing_official %} {% include "includes/contact.html" with contact=application.authorizing_official %} + {% else %} + Incomplete + {% endif %} {% endif %} {% if step == step_cls.CURRENT_SITES %}
    @@ -40,17 +49,21 @@ {% endif %} {% if step == step_cls.DOTGOV_DOMAIN %}
      -
    • {{ application.requested_domain.name }}
    • +
    • {{ application.requested_domain.name|default:"Incomplete" }}
    • {% for site in application.alternative_domains.all %}
    • {{ site.website }}
    • {% endfor %}
    {% endif %} {% if step == step_cls.PURPOSE %} - {{ application.purpose }} + {{ application.purpose|default:"Incomplete" }} {% endif %} {% if step == step_cls.YOUR_CONTACT %} - {% include "includes/contact.html" with contact=application.submitter %} + {% if application.submitter %} + {% include "includes/contact.html" with contact=application.submitter %} + {% else %} + Incomplete + {% endif %} {% endif %} {% if step == step_cls.OTHER_CONTACTS %} {% for other in application.other_contacts.all %} @@ -60,10 +73,13 @@ {% endfor %} {% endif %} {% if step == step_cls.SECURITY_EMAIL %} - {{ application.security_email }} + {{ application.security_email|default:"None" }} {% endif %} {% if step == step_cls.ANYTHING_ELSE %} - {{ application.anything_else }} + {{ application.anything_else|default:"No" }} + {% endif %} + {% if step == step_cls.REQUIREMENTS %} + {{ application.is_policy_acknowledged|yesno:"Agree,Do not agree,Do not agree" }} {% endif %}
@@ -72,7 +88,7 @@ href="{% url wizard.url_name step=step %}" >Edit {{ form_titles|get_item:step }}
-
+ {% endfor %} {{ block.super }} From 59f1e0e39abe218e3f1e70ae40b0e5c6f664118c Mon Sep 17 00:00:00 2001 From: Seamus Johnston Date: Wed, 14 Dec 2022 07:50:13 -0600 Subject: [PATCH 4/4] Fix bug --- src/registrar/templates/application_review.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registrar/templates/application_review.html b/src/registrar/templates/application_review.html index 33ac78921..44dd6975c 100644 --- a/src/registrar/templates/application_review.html +++ b/src/registrar/templates/application_review.html @@ -25,7 +25,7 @@ {{ application.is_election_board|yesno:"Yes,No,Incomplete" }} {% endif %} {% if step == step_cls.ORGANIZATION_CONTACT %} - {% if organization.organization_name %} + {% if application.organization_name %} {% include "includes/organization_address.html" with organization=application %} {% else %} Incomplete