mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-10 22:44:47 +02:00
Review feedback: more required instructions
This commit is contained in:
parent
29d8f4b23d
commit
beb9a298d4
5 changed files with 39 additions and 8 deletions
|
@ -101,9 +101,10 @@ class OrganizationContactForm(RegistrarForm):
|
|||
federal_agency = forms.ChoiceField(
|
||||
label="Federal agency",
|
||||
# not required because this field won't be filled out unless
|
||||
# it is a federal agency.
|
||||
# it is a federal agency. Use clean to check programatically
|
||||
# if it has been filled in when required.
|
||||
required=False,
|
||||
choices=DomainApplication.AGENCY_CHOICES,
|
||||
choices=[("", "--Select--")] + DomainApplication.AGENCY_CHOICES,
|
||||
label_suffix=REQUIRED_SUFFIX,
|
||||
)
|
||||
organization_name = forms.CharField(
|
||||
|
@ -138,6 +139,18 @@ class OrganizationContactForm(RegistrarForm):
|
|||
label="Urbanization (Puerto Rico only)",
|
||||
)
|
||||
|
||||
def clean_federal_agency(self):
|
||||
"""Require something to be selected when this is a federal agency."""
|
||||
federal_agency = self.cleaned_data.get("federal_agency", None)
|
||||
# need the wizard object to know if this is federal
|
||||
context = self.get_context()
|
||||
print(context)
|
||||
if wizard._is_federal():
|
||||
if not federal_agency:
|
||||
# no answer was selected
|
||||
raise forms.ValidationError("Please select your federal agency.", code="required")
|
||||
return federal_agency
|
||||
|
||||
|
||||
class AuthorizingOfficialForm(RegistrarForm):
|
||||
def to_database(self, obj):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue