diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-06-13 09:49:09 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-06-13 09:49:09 +0200 |
commit | 077dea01ed2d9afc97412631e4207eaf4175e06d (patch) | |
tree | 57a32eeff03668f481cbd91ccd6803e56666b36d /ishtar_common/wizards.py | |
parent | e3ff6616d2596a4e8d8fa83c1382c48d89fbc9dd (diff) | |
download | Ishtar-077dea01ed2d9afc97412631e4207eaf4175e06d.tar.bz2 Ishtar-077dea01ed2d9afc97412631e4207eaf4175e06d.zip |
Custom forms: manage customization of search forms
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r-- | ishtar_common/wizards.py | 20 |
1 files changed, 11 insertions, 9 deletions
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 |