mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-30 06:26:34 +02:00
initial approach, from domain.py, not quite working
This commit is contained in:
parent
a987c5dbcf
commit
2651cd4aba
1 changed files with 8 additions and 0 deletions
|
@ -296,6 +296,14 @@ class OrganizationContactForm(RegistrarForm):
|
|||
label="Urbanization (required for Puerto Rico only)",
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
# Set initial value for federal agency combo box and specify combobox template
|
||||
if self.domain_request and self.domain_request.federal_agency:
|
||||
self.fields["federal_agency"].initial = self.domain_request.federal_agency
|
||||
self.fields["federal_agency"].widget.attrs["data-default-value"] = self.domain_request.federal_agency.pk
|
||||
self.fields["federal_agency"].widget.template_name = "django/forms/widgets/combobox.html",
|
||||
|
||||
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue