mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-05 09:21:54 +02:00
dynamic options
This commit is contained in:
parent
e04337f94c
commit
b3e9096910
2 changed files with 10 additions and 1 deletions
|
@ -83,9 +83,17 @@ class RequestingEntityForm(RegistrarForm):
|
|||
class RequestingEntityYesNoForm(BaseYesNoForm):
|
||||
"""The yes/no field for the RequestingEntity form."""
|
||||
|
||||
form_choices = ((False, "Dynamic portfolio field"), (True, "A suborganization. (choose from list)"))
|
||||
# This first option will change dynamically
|
||||
form_choices = ((False, "Current Organization"), (True, "A suborganization. (choose from list)"))
|
||||
field_name = "is_suborganization"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""Extend the initialization of the form from RegistrarForm __init__"""
|
||||
super().__init__(*args, **kwargs)
|
||||
if self.domain_request.portfolio:
|
||||
self.form_choices = ((False, self.domain_request.portfolio), (True, "A suborganization. (choose from list)"))
|
||||
self.fields[self.field_name] = self.get_typed_choice_field()
|
||||
|
||||
@property
|
||||
def form_is_checked(self):
|
||||
"""
|
||||
|
|
|
@ -261,6 +261,7 @@ class BaseYesNoForm(RegistrarForm):
|
|||
"required": self.required_error_message,
|
||||
},
|
||||
)
|
||||
print(f"here are the form choices: {self.form_choices}, here is the initial: {self.get_initial_value()}")
|
||||
|
||||
return choice_field
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue