This commit is contained in:
David Kennedy 2024-01-02 18:31:36 -05:00
parent 0cada58c23
commit 55f9792b32
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
4 changed files with 60 additions and 4 deletions

View file

@ -39,9 +39,11 @@ class RegistrarForm(forms.Form):
Does nothing if form is not valid.
"""
logger.info(f"to_database called on {self.__class__.__name__}")
if not self.is_valid():
return
for name, value in self.cleaned_data.items():
logger.info(f"{name}: {value}")
setattr(obj, name, value)
obj.save()
@ -547,6 +549,21 @@ class YourContactForm(RegistrarForm):
)
class OtherContactsYesNoForm(RegistrarForm):
has_other_contacts = forms.TypedChoiceField(
choices=(
(True, "Yes, I can name other employees."),
(False, "No (We'll ask you to explain why).")
),
widget=forms.RadioSelect
)
def is_valid(self):
val = super().is_valid()
logger.info(f"yes no form is valid = {val}")
return val
class OtherContactsForm(RegistrarForm):
first_name = forms.CharField(
label="First name / given name",