mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-09 22:14:43 +02:00
Add a combo box only for federal agencies
This commit is contained in:
parent
9124f48548
commit
c5e406c400
6 changed files with 130 additions and 18 deletions
|
@ -28,10 +28,10 @@ class OrganizationTypeForm(RegistrarForm):
|
||||||
organization_type = forms.ChoiceField(
|
organization_type = forms.ChoiceField(
|
||||||
required=True,
|
required=True,
|
||||||
choices=[
|
choices=[
|
||||||
("Federal", "Federal: a federal agency"),
|
(DomainApplication.FEDERAL, "Federal: a federal agency"),
|
||||||
("Interstate", "Interstate: an organization of two or more states"),
|
(DomainApplication.INTERSTATE, "Interstate: an organization of two or more states"),
|
||||||
(
|
(
|
||||||
"State_or_Territory",
|
DomainApplication.STATE_OR_TERRITORY,
|
||||||
(
|
(
|
||||||
"State or Territory: One of the 50 U.S. states, the District of "
|
"State or Territory: One of the 50 U.S. states, the District of "
|
||||||
"Columbia, American Samoa, Guam, Northern Mariana Islands, "
|
"Columbia, American Samoa, Guam, Northern Mariana Islands, "
|
||||||
|
@ -39,16 +39,16 @@ class OrganizationTypeForm(RegistrarForm):
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"Tribal",
|
DomainApplication.TRIBAL,
|
||||||
(
|
(
|
||||||
"Tribal: a tribal government recognized by the federal or "
|
"Tribal: a tribal government recognized by the federal or "
|
||||||
"state government"
|
"state government"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
("County", "County: a county, parish, or borough"),
|
(DomainApplication.COUNTY, "County: a county, parish, or borough"),
|
||||||
("City", "City: a city, town, township, village, etc."),
|
(DomainApplication.CITY, "City: a city, town, township, village, etc."),
|
||||||
(
|
(
|
||||||
"Special_District",
|
DomainApplication.SPECIAL_DISTRICT,
|
||||||
"Special District: an independent organization within a single state",
|
"Special District: an independent organization within a single state",
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -314,10 +314,36 @@ class ApplicationWizard(LoginRequiredMixin, NamedUrlSessionWizardView):
|
||||||
"""
|
"""
|
||||||
return [TEMPLATES[self.steps.current]]
|
return [TEMPLATES[self.steps.current]]
|
||||||
|
|
||||||
|
def _is_federal(self) -> bool:
|
||||||
|
"""Return whether this application is from a federal agency.
|
||||||
|
|
||||||
|
Returns True if we know that this application is from a federal
|
||||||
|
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")
|
||||||
|
print(organization_type)
|
||||||
|
if organization_type is None:
|
||||||
|
# they haven't answered this question
|
||||||
|
print("No organization type: returning None")
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
# they have answered this question
|
||||||
|
if organization_type == DomainApplication.FEDERAL:
|
||||||
|
print("organization type is federal: returning true")
|
||||||
|
return True
|
||||||
|
print("organization type is not federal: returning false")
|
||||||
|
return False
|
||||||
|
|
||||||
def get_context_data(self, form, **kwargs):
|
def get_context_data(self, form, **kwargs):
|
||||||
"""Add title information to the context for all steps."""
|
"""Add title information to the context for all steps."""
|
||||||
context = super().get_context_data(form=form, **kwargs)
|
context = super().get_context_data(form=form, **kwargs)
|
||||||
context["form_titles"] = TITLES
|
context["form_titles"] = TITLES
|
||||||
|
if self.steps.current == "organization_contact":
|
||||||
|
context["is_federal"] = self._is_federal()
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def forms_to_object(self, form_dict: dict) -> DomainApplication:
|
def forms_to_object(self, form_dict: dict) -> DomainApplication:
|
||||||
|
|
|
@ -253,7 +253,10 @@ class DomainApplication(TimeStampedModel):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def show_organization_federal(wizard: ApplicationWizard) -> bool:
|
def show_organization_federal(wizard: ApplicationWizard) -> bool:
|
||||||
"""Show this step if the answer to the first question was "federal"."""
|
"""Show this step if the answer to the first question was "federal"."""
|
||||||
return DomainApplication._get_organization_type(wizard) == "Federal"
|
return (
|
||||||
|
DomainApplication._get_organization_type(wizard)
|
||||||
|
== DomainApplication.FEDERAL
|
||||||
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def show_organization_election(wizard: ApplicationWizard) -> bool:
|
def show_organization_election(wizard: ApplicationWizard) -> bool:
|
||||||
|
@ -262,6 +265,9 @@ class DomainApplication(TimeStampedModel):
|
||||||
This shows for answers that aren't "Federal" or "Interstate".
|
This shows for answers that aren't "Federal" or "Interstate".
|
||||||
"""
|
"""
|
||||||
type_answer = DomainApplication._get_organization_type(wizard)
|
type_answer = DomainApplication._get_organization_type(wizard)
|
||||||
if type_answer and type_answer not in ("Federal", "Interstate"):
|
if type_answer and type_answer not in (
|
||||||
|
DomainApplication.FEDERAL,
|
||||||
|
DomainApplication.INTERSTATE,
|
||||||
|
):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -22,8 +22,12 @@
|
||||||
|
|
||||||
<fieldset class="usa-fieldset">
|
<fieldset class="usa-fieldset">
|
||||||
<legend class="usa-sr-only">What is the name and mailing address of your organization?</legend>
|
<legend class="usa-sr-only">What is the name and mailing address of your organization?</legend>
|
||||||
{{ wizard.form.organization_name|add_label_class:"usa-label" }}
|
|
||||||
{{ wizard.form.organization_name|add_class:"usa-input" }}
|
{% if is_federal %}
|
||||||
|
{% include 'includes/organization_federal.html' %}
|
||||||
|
{% else %}
|
||||||
|
{% include 'includes/organization_nonfederal.html' %}
|
||||||
|
{% endif %}
|
||||||
{{ wizard.form.address_line1|add_label_class:"usa-label" }}
|
{{ wizard.form.address_line1|add_label_class:"usa-label" }}
|
||||||
{{ wizard.form.address_line1|add_class:"usa-input" }}
|
{{ wizard.form.address_line1|add_class:"usa-input" }}
|
||||||
{{ wizard.form.address_line2|add_label_class:"usa-label" }}
|
{{ wizard.form.address_line2|add_label_class:"usa-label" }}
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
<h2> What kind of government organization do you represent?</h2>
|
<h2> What kind of government organization do you represent?</h2>
|
||||||
</legend>
|
</legend>
|
||||||
{{ wizard.form.organization_type.errors }}
|
{{ wizard.form.organization_type.errors }}
|
||||||
{% include "includes/radio_button.html" with choice=choices.Federal tile="true" %}
|
{% include "includes/radio_button.html" with choice=choices.federal tile="true" %}
|
||||||
{% include "includes/radio_button.html" with choice=choices.Interstate tile="true" %}
|
{% include "includes/radio_button.html" with choice=choices.interstate tile="true" %}
|
||||||
{% include "includes/radio_button.html" with choice=choices.State_or_Territory tile="true" %}
|
{% include "includes/radio_button.html" with choice=choices.state_or_territory tile="true" %}
|
||||||
{% include "includes/radio_button.html" with choice=choices.Tribal tile="true" %}
|
{% include "includes/radio_button.html" with choice=choices.tribal tile="true" %}
|
||||||
{% include "includes/radio_button.html" with choice=choices.County tile="true" %}
|
{% include "includes/radio_button.html" with choice=choices.county tile="true" %}
|
||||||
{% include "includes/radio_button.html" with choice=choices.City tile="true" %}
|
{% include "includes/radio_button.html" with choice=choices.city tile="true" %}
|
||||||
{% include "includes/radio_button.html" with choice=choices.Special_District tile="true" %}
|
{% include "includes/radio_button.html" with choice=choices.special_district tile="true" %}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
|
|
72
src/registrar/templates/includes/organization_federal.html
Normal file
72
src/registrar/templates/includes/organization_federal.html
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
{% load widget_tweaks %}
|
||||||
|
|
||||||
|
{{ wizard.form.organization_name|add_label_class:"usa-label" }}
|
||||||
|
<div class="usa-combo-box">
|
||||||
|
<select class="usa-select" name="fruit" id="id_organization_contact-organization_name">
|
||||||
|
<option value>Select a fruit</option>
|
||||||
|
<option value="apple">Apple</option>
|
||||||
|
<option value="apricot">Apricot</option>
|
||||||
|
<option value="avocado">Avocado</option>
|
||||||
|
<option value="banana">Banana</option>
|
||||||
|
<option value="blackberry">Blackberry</option>
|
||||||
|
<option value="blood orange">Blood orange</option>
|
||||||
|
<option value="blueberry">Blueberry</option>
|
||||||
|
<option value="boysenberry">Boysenberry</option>
|
||||||
|
<option value="breadfruit">Breadfruit</option>
|
||||||
|
<option value="buddhas hand citron">Buddha's hand citron</option>
|
||||||
|
<option value="cantaloupe">Cantaloupe</option>
|
||||||
|
<option value="clementine">Clementine</option>
|
||||||
|
<option value="crab apple">Crab apple</option>
|
||||||
|
<option value="currant">Currant</option>
|
||||||
|
<option value="cherry">Cherry</option>
|
||||||
|
<option value="custard apple">Custard apple</option>
|
||||||
|
<option value="coconut">Coconut</option>
|
||||||
|
<option value="cranberry">Cranberry</option>
|
||||||
|
<option value="date">Date</option>
|
||||||
|
<option value="dragonfruit">Dragonfruit</option>
|
||||||
|
<option value="durian">Durian</option>
|
||||||
|
<option value="elderberry">Elderberry</option>
|
||||||
|
<option value="fig">Fig</option>
|
||||||
|
<option value="gooseberry">Gooseberry</option>
|
||||||
|
<option value="grape">Grape</option>
|
||||||
|
<option value="grapefruit">Grapefruit</option>
|
||||||
|
<option value="guava">Guava</option>
|
||||||
|
<option value="honeydew melon">Honeydew melon</option>
|
||||||
|
<option value="jackfruit">Jackfruit</option>
|
||||||
|
<option value="kiwifruit">Kiwifruit</option>
|
||||||
|
<option value="kumquat">Kumquat</option>
|
||||||
|
<option value="lemon">Lemon</option>
|
||||||
|
<option value="lime">Lime</option>
|
||||||
|
<option value="lychee">Lychee</option>
|
||||||
|
<option value="mandarine">Mandarine</option>
|
||||||
|
<option value="mango">Mango</option>
|
||||||
|
<option value="mangosteen">Mangosteen</option>
|
||||||
|
<option value="marionberry">Marionberry</option>
|
||||||
|
<option value="nectarine">Nectarine</option>
|
||||||
|
<option value="orange">Orange</option>
|
||||||
|
<option value="papaya">Papaya</option>
|
||||||
|
<option value="passionfruit">Passionfruit</option>
|
||||||
|
<option value="peach">Peach</option>
|
||||||
|
<option value="pear">Pear</option>
|
||||||
|
<option value="persimmon">Persimmon</option>
|
||||||
|
<option value="plantain">Plantain</option>
|
||||||
|
<option value="plum">Plum</option>
|
||||||
|
<option value="pineapple">Pineapple</option>
|
||||||
|
<option value="pluot">Pluot</option>
|
||||||
|
<option value="pomegranate">Pomegranate</option>
|
||||||
|
<option value="pomelo">Pomelo</option>
|
||||||
|
<option value="quince">Quince</option>
|
||||||
|
<option value="raspberry">Raspberry</option>
|
||||||
|
<option value="rambutan">Rambutan</option>
|
||||||
|
<option value="soursop">Soursop</option>
|
||||||
|
<option value="starfruit">Starfruit</option>
|
||||||
|
<option value="strawberry">Strawberry</option>
|
||||||
|
<option value="tamarind">Tamarind</option>
|
||||||
|
<option value="tangelo">Tangelo</option>
|
||||||
|
<option value="tangerine">Tangerine</option>
|
||||||
|
<option value="ugli fruit">Ugli fruit</option>
|
||||||
|
<option value="watermelon">Watermelon</option>
|
||||||
|
<option value="white currant">White currant</option>
|
||||||
|
<option value="yuzu">Yuzu</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
|
@ -0,0 +1,4 @@
|
||||||
|
{% load widget_tweaks %}
|
||||||
|
|
||||||
|
{{ wizard.form.organization_name|add_label_class:"usa-label" }}
|
||||||
|
{{ wizard.form.organization_name|add_class:"usa-input" }}
|
Loading…
Add table
Add a link
Reference in a new issue