From b8b8b561ea52729d54c3ea44cc6b6a05450f9dcb Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 13 Jun 2018 09:49:09 +0200 Subject: Custom forms: manage customization of search forms --- ishtar_common/wizards.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'ishtar_common/wizards.py') diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index 979f611ce..4a55345d2 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -87,7 +87,16 @@ def filter_no_fields_form(form, other_check=None): return func -class Wizard(NamedUrlWizardView): +class IshtarWizard(NamedUrlWizardView): + def get_form_kwargs(self, step=None): + kwargs = super(IshtarWizard, self).get_form_kwargs(step) + if hasattr(self.form_list[step], 'need_user_for_initialization') and \ + self.form_list[step].need_user_for_initialization: + kwargs['user'] = self.request.user + return kwargs + + +class Wizard(IshtarWizard): model = None label = '' translated_keys = [] @@ -167,13 +176,6 @@ class Wizard(NamedUrlWizardView): return super(Wizard, self).dispatch(request, *args, **kwargs) - def get_form_kwargs(self, step=None): - kwargs = super(Wizard, self).get_form_kwargs(step) - if hasattr(self.form_list[step], 'need_user_for_initialization') and\ - self.form_list[step].need_user_for_initialization: - kwargs['user'] = self.request.user - return kwargs - def get_prefix(self, request, *args, **kwargs): """As the class name can interfere when reused prefix with the url_name """ @@ -1382,7 +1384,7 @@ class Wizard(NamedUrlWizardView): return initial -class SearchWizard(NamedUrlWizardView): +class SearchWizard(IshtarWizard): model = None label = '' modification = None # True when the wizard modify an item -- cgit v1.2.3