From 48f0369743247011b259f6a66ff3f426714a5ec7 Mon Sep 17 00:00:00 2001 From: Neil Martinsen-Burrell Date: Thu, 8 Dec 2022 14:13:01 -0600 Subject: [PATCH] Review Feedback: labels, organization, etc. --- src/registrar/forms/application_wizard.py | 164 +-------------------- src/registrar/models/domain_application.py | 156 +++++++++++++++++++- src/registrar/tests/test_views.py | 1 + 3 files changed, 163 insertions(+), 158 deletions(-) diff --git a/src/registrar/forms/application_wizard.py b/src/registrar/forms/application_wizard.py index 7c03b3924..0975b6810 100644 --- a/src/registrar/forms/application_wizard.py +++ b/src/registrar/forms/application_wizard.py @@ -73,160 +73,21 @@ class OrganizationElectionForm(RegistrarForm): class OrganizationContactForm(RegistrarForm): # for federal agencies we also want to know the top-level agency. federal_agency = forms.ChoiceField( - label="Top level federal agency", + label="Federal agency", # not required because this field won't be filled out unless # it is a federal agency. required=False, - choices=[ - (v, v) - for v in [ - "", - "Administrative Conference of the United States", - "Advisory Council on Historic Preservation", - "American Battle Monuments Commission", - "Appalachian Regional Commission", - ( - "Appraisal Subcommittee of the Federal Financial " - "Institutions Examination Council" - ), - "Armed Forces Retirement Home", - "Barry Goldwater Scholarship and Excellence in Education Program", - "Central Intelligence Agency", - "Christopher Columbus Fellowship Foundation", - "Commission for the Preservation of America's Heritage Abroad", - "Commission of Fine Arts", - "Committee for Purchase From People Who Are Blind or Severely Disabled", - "Commodity Futures Trading Commission", - "Consumer Financial Protection Bureau", - "Consumer Product Safety Commission", - "Corporation for National and Community Service", - "Council of Inspectors General on Integrity and Efficiency", - "DC Court Services and Offender Supervision Agency", - "DC Pre-trial Services", - "Defense Nuclear Facilities Safety Board", - "Delta Regional Authority", - "Denali Commission", - "Department of Agriculture", - "Department of Commerce", - "Department of Defense", - "Department of Education", - "Department of Energy", - "Department of Health and Human Services", - "Department of Homeland Security", - "Department of Housing and Urban Development", - "Department of Justice", - "Department of Labor", - "Department of State", - "Department of the Interior", - "Department of the Treasury", - "Department of Transportation", - "Department of Veterans Affairs", - "Director of National Intelligence", - "Dwight D. Eisenhower Memorial Commission", - "Election Assistance Commission", - "Environmental Protection Agency", - "Equal Employment Opportunity Commission", - "Export-Import Bank of the United States", - "Farm Credit Administration", - "Farm Credit System Insurance Corporation", - "Federal Communications Commission", - "Federal Deposit Insurance Corporation", - "Federal Election Commission", - "Federal Financial Institutions Examination Council", - "Federal Housing Finance Agency", - "Federal Judiciary", - "Federal Labor Relations Authority", - "Federal Maritime Commission", - "Federal Mediation and Conciliation Service", - "Federal Mine Safety and Health Review Commission", - "Federal Reserve System", - "Federal Trade Commission", - "General Services Administration", - "Gulf Coast Ecosystem Restoration Council", - "Harry S Truman Scholarship Foundation", - "Institute of Peace", - "Inter-American Foundation", - "International Boundary and Water Commission: United States and Mexico", - "International Boundary Commission: United States and Canada", - "International Joint Commission: United States and Canada", - "James Madison Memorial Fellowship Foundation", - "Japan-United States Friendship Commission", - "John F. Kennedy Center for the Performing Arts", - "Legal Services Corporation", - "Legislative Branch", - "Marine Mammal Commission", - "Medicare Payment Advisory Commission", - "Merit Systems Protection Board", - "Millennium Challenge Corporation", - "National Aeronautics and Space Administration", - "National Archives and Records Administration", - "National Capital Planning Commission", - "National Council on Disability", - "National Credit Union Administration", - "National Foundation on the Arts and the Humanities", - "National Gallery of Art", - "National Labor Relations Board", - "National Mediation Board", - "National Science Foundation", - "National Transportation Safety Board", - "Northern Border Regional Commission", - "Nuclear Regulatory Commission", - "Nuclear Safety Oversight Committee", - "Nuclear Waste Technical Review Board", - "Occupational Safety and Health Review Commission", - "Office of Compliance", - "Office of Government Ethics", - "Office of Navajo and Hopi Indian Relocation", - "Office of Personnel Management", - "Overseas Private Investment Corporation", - "Peace Corps", - "Pension Benefit Guaranty Corporation", - "Postal Regulatory Commission", - "Privacy and Civil Liberties Oversight Board", - "Public Defender Service for the District of Columbia", - "Railroad Retirement Board", - "Securities and Exchange Commission", - "Selective Service System", - "Small Business Administration", - "Smithsonian Institution", - "Social Security Administration", - "State Justice Institute", - "State, Local, and Tribal Government", - "Stennis Center for Public Service", - "Surface Transportation Board", - "Tennessee Valley Authority", - "The Executive Office of the President", - "U.S. Access Board", - "U.S. Agency for Global Media", - "U.S. Agency for International Development", - "U.S. Chemical Safety Board", - "U.S. China Economic and Security Review Commission", - "U.S. Commission on Civil Rights", - "U.S. Commission on International Religious Freedom", - "U.S. Interagency Council on Homelessness", - "U.S. International Trade Commission", - "U.S. Office of Special Counsel", - "U.S. Postal Service", - "U.S. Trade and Development Agency", - "Udall Foundation", - "United States African Development Foundation", - "United States Arctic Research Commission", - "United States Holocaust Memorial Museum", - "Utah Reclamation Mitigation and Conservation Commission", - "Vietnam Education Foundation", - "Woodrow Wilson International Center for Scholars", - "World War I Centennial Commission", - ] - ], + choices=DomainApplication.AGENCY_CHOICES, ) - organization_name = forms.CharField(label="Organization Name") + organization_name = forms.CharField(label="Organization name") address_line1 = forms.CharField(label="Address line 1") address_line2 = forms.CharField( required=False, label="Address line 2", ) state_territory = forms.ChoiceField( - label="State", choices=DomainApplication.StateTerritoryChoices.choices + label="State/territory", + choices=[("", "--Select--")] + DomainApplication.StateTerritoryChoices.choices, ) zipcode = forms.CharField(label="ZIP code") @@ -546,24 +407,13 @@ class ApplicationWizard(LoginRequiredMixin, NamedUrlSessionWizardView): agency, False if we know that it is not and None if there isn't an answer yet for that question. """ - organization_type_data = self.get_cleaned_data_for_step("organization_type") - if organization_type_data is None: - return None # no answers here yet - organization_type = organization_type_data.get("organization_type") - if organization_type is None: - # they haven't answered this question - return None - else: - # they have answered this question - if organization_type == DomainApplication.OrganizationChoices.FEDERAL: - return True - return False + return self.get_application_object().is_federal() def get_context_data(self, form, **kwargs): """Add title information to the context for all steps.""" context = super().get_context_data(form=form, **kwargs) context["form_titles"] = TITLES - if self.steps.current == "organization_contact": + if self.steps.current == Step.ORGANIZATION_CONTACT: context["is_federal"] = self._is_federal() return context diff --git a/src/registrar/models/domain_application.py b/src/registrar/models/domain_application.py index 529710007..f9332fae7 100644 --- a/src/registrar/models/domain_application.py +++ b/src/registrar/models/domain_application.py @@ -108,6 +108,146 @@ class DomainApplication(TimeStampedModel): JUDICIAL = "judicial", "Judicial" LEGISLATIVE = "legislative", "Legislative" + AGENCIES = [ + "", + "Administrative Conference of the United States", + "Advisory Council on Historic Preservation", + "American Battle Monuments Commission", + "Appalachian Regional Commission", + ( + "Appraisal Subcommittee of the Federal Financial " + "Institutions Examination Council" + ), + "Armed Forces Retirement Home", + "Barry Goldwater Scholarship and Excellence in Education Program", + "Central Intelligence Agency", + "Christopher Columbus Fellowship Foundation", + "Commission for the Preservation of America's Heritage Abroad", + "Commission of Fine Arts", + "Committee for Purchase From People Who Are Blind or Severely Disabled", + "Commodity Futures Trading Commission", + "Consumer Financial Protection Bureau", + "Consumer Product Safety Commission", + "Corporation for National and Community Service", + "Council of Inspectors General on Integrity and Efficiency", + "DC Court Services and Offender Supervision Agency", + "DC Pre-trial Services", + "Defense Nuclear Facilities Safety Board", + "Delta Regional Authority", + "Denali Commission", + "Department of Agriculture", + "Department of Commerce", + "Department of Defense", + "Department of Education", + "Department of Energy", + "Department of Health and Human Services", + "Department of Homeland Security", + "Department of Housing and Urban Development", + "Department of Justice", + "Department of Labor", + "Department of State", + "Department of the Interior", + "Department of the Treasury", + "Department of Transportation", + "Department of Veterans Affairs", + "Director of National Intelligence", + "Dwight D. Eisenhower Memorial Commission", + "Election Assistance Commission", + "Environmental Protection Agency", + "Equal Employment Opportunity Commission", + "Export-Import Bank of the United States", + "Farm Credit Administration", + "Farm Credit System Insurance Corporation", + "Federal Communications Commission", + "Federal Deposit Insurance Corporation", + "Federal Election Commission", + "Federal Financial Institutions Examination Council", + "Federal Housing Finance Agency", + "Federal Judiciary", + "Federal Labor Relations Authority", + "Federal Maritime Commission", + "Federal Mediation and Conciliation Service", + "Federal Mine Safety and Health Review Commission", + "Federal Reserve System", + "Federal Trade Commission", + "General Services Administration", + "Gulf Coast Ecosystem Restoration Council", + "Harry S Truman Scholarship Foundation", + "Institute of Peace", + "Inter-American Foundation", + "International Boundary and Water Commission: United States and Mexico", + "International Boundary Commission: United States and Canada", + "International Joint Commission: United States and Canada", + "James Madison Memorial Fellowship Foundation", + "Japan-United States Friendship Commission", + "John F. Kennedy Center for the Performing Arts", + "Legal Services Corporation", + "Legislative Branch", + "Marine Mammal Commission", + "Medicare Payment Advisory Commission", + "Merit Systems Protection Board", + "Millennium Challenge Corporation", + "National Aeronautics and Space Administration", + "National Archives and Records Administration", + "National Capital Planning Commission", + "National Council on Disability", + "National Credit Union Administration", + "National Foundation on the Arts and the Humanities", + "National Gallery of Art", + "National Labor Relations Board", + "National Mediation Board", + "National Science Foundation", + "National Transportation Safety Board", + "Northern Border Regional Commission", + "Nuclear Regulatory Commission", + "Nuclear Safety Oversight Committee", + "Nuclear Waste Technical Review Board", + "Occupational Safety and Health Review Commission", + "Office of Compliance", + "Office of Government Ethics", + "Office of Navajo and Hopi Indian Relocation", + "Office of Personnel Management", + "Overseas Private Investment Corporation", + "Peace Corps", + "Pension Benefit Guaranty Corporation", + "Postal Regulatory Commission", + "Privacy and Civil Liberties Oversight Board", + "Public Defender Service for the District of Columbia", + "Railroad Retirement Board", + "Securities and Exchange Commission", + "Selective Service System", + "Small Business Administration", + "Smithsonian Institution", + "Social Security Administration", + "State Justice Institute", + "State, Local, and Tribal Government", + "Stennis Center for Public Service", + "Surface Transportation Board", + "Tennessee Valley Authority", + "The Executive Office of the President", + "U.S. Access Board", + "U.S. Agency for Global Media", + "U.S. Agency for International Development", + "U.S. Chemical Safety Board", + "U.S. China Economic and Security Review Commission", + "U.S. Commission on Civil Rights", + "U.S. Commission on International Religious Freedom", + "U.S. Interagency Council on Homelessness", + "U.S. International Trade Commission", + "U.S. Office of Special Counsel", + "U.S. Postal Service", + "U.S. Trade and Development Agency", + "Udall Foundation", + "United States African Development Foundation", + "United States Arctic Research Commission", + "United States Holocaust Memorial Museum", + "Utah Reclamation Mitigation and Conservation Commission", + "Vietnam Education Foundation", + "Woodrow Wilson International Center for Scholars", + "World War I Centennial Commission", + ] + AGENCY_CHOICES = [(v, v) for v in AGENCIES] + # #### Internal fields about the application ##### status = FSMField( choices=STATUS_CHOICES, # possible states as an array of constants @@ -139,7 +279,9 @@ class DomainApplication(TimeStampedModel): ) federal_agency = models.TextField( - null=True, blank=False, help_text="Top level federal agency" + null=True, + blank=False, + help_text="Top level federal agency", ) federal_type = models.CharField( @@ -323,3 +465,15 @@ class DomainApplication(TimeStampedModel): DomainApplication.OrganizationChoices.INTERSTATE, ] return bool(user_choice and user_choice not in excluded) + + def is_federal(self) -> Union[bool, None]: + """Is this application for a federal agency? + + organization_type can be both null and blank, + """ + if not self.organization_type: + # organization_type is either blank or None, can't answer + return None + if self.organization_type == DomainApplication.OrganizationChoices.FEDERAL: + return True + return False diff --git a/src/registrar/tests/test_views.py b/src/registrar/tests/test_views.py index 88b5a8686..7de062da3 100644 --- a/src/registrar/tests/test_views.py +++ b/src/registrar/tests/test_views.py @@ -178,6 +178,7 @@ class DomainApplicationTests(TestWithUser, WebTest): # ---- ORG CONTACT PAGE ---- # Follow the redirect to the next form page + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) org_contact_page = federal_result.follow() org_contact_form = org_contact_page.form org_contact_form["organization_contact-organization_name"] = "Testorg"