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 /ishtar_common | |
parent | 249b6c73e645674d8ca699be25a138bceacd477d (diff) | |
download | Ishtar-20a8009562b4d03b334469fbe2902386be3371f4.tar.bz2 Ishtar-20a8009562b4d03b334469fbe2902386be3371f4.zip |
🐛 Custom forms: fix crash when removing fields already filtered
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/forms.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index b0bf64b46..0f1263bef 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -195,6 +195,16 @@ class CustomForm(BSForm): if not self._explicit_ordering: self.custom_form_ordering() + def _remove_fields(self, field_names): + """ + Remove field (if already present) + """ + if not getattr(self, "fields", None): + return + for name in field_names: + if name in self.fields: + self.fields.pop(name) + def custom_form_ordering(self): available, header, excluded, json_fields = self.check_custom_form( self.current_user) |