Fix DELETE getter in form's clean, add test_delete_other_contact_does_not_allow_zero_contacts, cleanup

This commit is contained in:
Rachid Mrad 2024-01-09 13:03:23 -05:00
parent eb7498b28e
commit f2b12e01d0
No known key found for this signature in database
GPG key ID: EF38E4CEC4A8F3CF
3 changed files with 111 additions and 22 deletions

View file

@ -672,7 +672,7 @@ class OtherContactsForm(RegistrarForm):
deletion by formset to be considered valid even though certain required fields have
not passed field validation
"""
if self.form_data_marked_for_deletion or self.cleaned_data["DELETE"]:
if self.form_data_marked_for_deletion or self.cleaned_data.get("DELETE"):
# clear any errors raised by the form fields
# (before this clean() method is run, each field
# performs its own clean, which could result in