dynamic options

This commit is contained in:
zandercymatics 2024-10-17 15:46:26 -06:00
parent e04337f94c
commit b3e9096910
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
2 changed files with 10 additions and 1 deletions

View file

@ -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):
"""

View file

@ -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