diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-10-18 12:48:05 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-10-18 12:50:55 +0200 |
commit | 20a8009562b4d03b334469fbe2902386be3371f4 (patch) | |
tree | 339fb76b82e542887d21a123a53c23631c42c9f3 /archaeological_finds/forms.py | |
parent | 249b6c73e645674d8ca699be25a138bceacd477d (diff) | |
download | Ishtar-20a8009562b4d03b334469fbe2902386be3371f4.tar.bz2 Ishtar-20a8009562b4d03b334469fbe2902386be3371f4.zip |
🐛 Custom forms: fix crash when removing fields already filtered
Diffstat (limited to 'archaeological_finds/forms.py')
-rw-r--r-- | archaeological_finds/forms.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index 9bc3f56ff..691383cc6 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -415,9 +415,9 @@ class BasicFindForm(CustomForm, ManageOldType): def __init__(self, *args, **kwargs): context_record = kwargs.pop("context_record") - super(BasicFindForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if not context_record or not context_record.operation.operation_type.judiciary: - self.fields.pop("seal_number") + self._remove_fields(("seal_number",)) def clean(self): clutter_long_side = self.cleaned_data.get("clutter_long_side", None) @@ -875,19 +875,20 @@ class QAFindFormMulti(QAForm): class QAFindFormSingle(QAFindFormMulti): + # TODO: not used? MULTI = False form_admin_name = _("Find - Quick action - Modify single") form_slug = "find-quickaction-modifysingle" def __init__(self, *args, **kwargs): - super(QAFindFormSingle, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if ( not self.items or not self.items[0] .get_first_base_find() .context_record.operation.operation_type.judiciary ): - self.fields.pop("qa_seal_number") + self._remove_fields(("qa_seal_number",)) class QAFindBasketForm(IshtarForm): |