From 40c94fba1a9e3e119af8738f75f1e8082feb0c8b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 5 Sep 2018 10:41:24 +0200 Subject: Quick actions: generic urls, views and forms --- ishtar_common/forms.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ishtar_common/forms.py') diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index 3dfcad09e..4300e9c36 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -640,6 +640,21 @@ class ManageOldType(IshtarForm): self.fields[field.key].help_text = field.get_help() +class QAForm(CustomForm, ManageOldType): + MULTI = False + + def __init__(self, *args, **kwargs): + self.items = kwargs.pop('items') + super(QAForm, self).__init__(*args, **kwargs) + for k in self.fields: + if self.MULTI and k not in self.REPLACE_FIELDS: + self.fields[k].label = unicode(self.fields[k].label) + \ + unicode(u" - append to existing") + else: + self.fields[k].label = unicode(self.fields[k].label) + \ + unicode(u" - replace") + + class DocumentGenerationForm(forms.Form): """ Form to generate document by choosing the template -- cgit v1.2.3