mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-04 02:03:32 +02:00
Change init on BaseOtherContactsFormSet to show required on first form
This commit is contained in:
parent
1d1496a8ed
commit
358aef1081
1 changed files with 11 additions and 1 deletions
|
@ -681,7 +681,17 @@ class BaseOtherContactsFormSet(RegistrarFormSet):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.formset_data_marked_for_deletion = False
|
self.formset_data_marked_for_deletion = False
|
||||||
super().__init__(*args, **kwargs)
|
self.application = kwargs.pop("application", None)
|
||||||
|
super(RegistrarFormSet, self).__init__(*args, **kwargs)
|
||||||
|
# quick workaround to ensure that the HTML `required`
|
||||||
|
# attribute shows up on required fields for any forms
|
||||||
|
# in the formset which have data already (stated another
|
||||||
|
# way: you can leave a form in the formset blank, but
|
||||||
|
# if you opt to fill it out, you must fill it out _right_)
|
||||||
|
for index in range(max(self.initial_form_count(), 1)):
|
||||||
|
self.forms[index].use_required_attribute = True
|
||||||
|
|
||||||
|
# self.forms[0].use_required_attribute = True
|
||||||
|
|
||||||
def pre_update(self, db_obj, cleaned):
|
def pre_update(self, db_obj, cleaned):
|
||||||
"""Code to run before an item in the formset is saved."""
|
"""Code to run before an item in the formset is saved."""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue