mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-20 00:14:16 +02:00
organization edit form - added state territory combobox
This commit is contained in:
parent
d54e57b084
commit
e2486c127d
1 changed files with 7 additions and 10 deletions
|
@ -6,6 +6,7 @@ from django.core.validators import RegexValidator
|
|||
from django.core.validators import MaxLengthValidator
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from registrar.forms.utility.combobox import ComboboxWidget
|
||||
from registrar.models import (
|
||||
PortfolioInvitation,
|
||||
UserPortfolioPermission,
|
||||
|
@ -33,6 +34,12 @@ class PortfolioOrgAddressForm(forms.ModelForm):
|
|||
"required": "Enter a 5-digit or 9-digit zip code, like 12345 or 12345-6789.",
|
||||
},
|
||||
)
|
||||
state_territory = forms.ChoiceField(
|
||||
label="State, territory, or military post",
|
||||
required=True,
|
||||
choices=DomainInformation.StateTerritoryChoices.choices,
|
||||
widget=ComboboxWidget,
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = Portfolio
|
||||
|
@ -53,19 +60,9 @@ class PortfolioOrgAddressForm(forms.ModelForm):
|
|||
"zipcode": {"required": "Enter a 5-digit or 9-digit zip code, like 12345 or 12345-6789."},
|
||||
}
|
||||
widgets = {
|
||||
# We need to set the required attributed for State/territory
|
||||
# because for this fields we are creating an individual
|
||||
# instance of the Select. For the other fields we use the for loop to set
|
||||
# the class's required attribute to true.
|
||||
"address_line1": forms.TextInput,
|
||||
"address_line2": forms.TextInput,
|
||||
"city": forms.TextInput,
|
||||
"state_territory": forms.Select(
|
||||
attrs={
|
||||
"required": True,
|
||||
},
|
||||
choices=DomainInformation.StateTerritoryChoices.choices,
|
||||
),
|
||||
# "urbanization": forms.TextInput,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue