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 | b8b8b561ea52729d54c3ea44cc6b6a05450f9dcb (patch) | |
tree | 57a32eeff03668f481cbd91ccd6803e56666b36d /ishtar_common/wizards.py | |
parent | 003c37f1a2c31da847435b425e4755dc4fb58e15 (diff) | |
download | Ishtar-b8b8b561ea52729d54c3ea44cc6b6a05450f9dcb.tar.bz2 Ishtar-b8b8b561ea52729d54c3ea44cc6b6a05450f9dcb.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 |