From 23fb7114d46ffae071891fb0bbdd6521dd4d5265 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 6 Sep 2018 18:18:07 +0200 Subject: Quick action: manage ajax form --- ishtar_common/forms.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ishtar_common/forms.py') diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index 106b68c14..2e249e472 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -455,6 +455,8 @@ class IshtarForm(forms.Form): if not getattr(profile, profile_key): for field_key in self.PROFILE_FILTER[profile_key]: self.fields.pop(field_key) + if getattr(self, 'confirm', True): + return for field in self.TYPES: self._init_type(field) for k in self.fields: @@ -646,11 +648,14 @@ class QAForm(CustomForm, ManageOldType): def __init__(self, *args, **kwargs): self.items = kwargs.pop('items') + self.confirm = kwargs.pop('confirm') super(QAForm, self).__init__(*args, **kwargs) for k in self.fields.keys(): if self.MULTI and k in self.SINGLE_FIELDS: self.fields.pop(k) continue + if self.confirm: + self.fields[k].widget = forms.HiddenInput() if self.MULTI and k not in self.REPLACE_FIELDS: self.fields[k].label = unicode(self.fields[k].label) + \ unicode(u" - append to existing") -- cgit v1.2.3