diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-25 12:06:36 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:25 +0100 |
commit | 70a69dcea0bb92ef346c51da42122bf0f883dac9 (patch) | |
tree | 52779d05a64ead1ca6a9882cda58f9dd767a50cc /ishtar_common | |
parent | 3dbeac686f1519ed8b9a961202b7ec2264591af9 (diff) | |
download | Ishtar-70a69dcea0bb92ef346c51da42122bf0f883dac9.tar.bz2 Ishtar-70a69dcea0bb92ef346c51da42122bf0f883dac9.zip |
Generic extra forms modals for all pages (refs #5052)
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/views.py | 5 | ||||
-rw-r--r-- | ishtar_common/wizards.py | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 45a7530c7..cb1af7c5d 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -119,7 +119,10 @@ def index(request): """ Main page """ - dct = {'warnings': []} + dct = { + 'warnings': [], + "extra_form_modals": wizards.EXTRA_FORM_MODALS + } if settings.PROJECT_SLUG == 'default': dct['warnings'].append(_( "PROJECT_SLUG is set to \"default\". Change it in your " diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index b23069d36..e72ed2cb1 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -89,6 +89,9 @@ def filter_no_fields_form(form, other_check=None): return func +EXTRA_FORM_MODALS = ["container", "warehouse", "person", "organization"] + + class IshtarWizard(NamedUrlWizardView): def get_form_kwargs(self, step=None): kwargs = super(IshtarWizard, self).get_form_kwargs(step) @@ -99,8 +102,9 @@ class IshtarWizard(NamedUrlWizardView): def get_context_data(self, form, **kwargs): context = super(IshtarWizard, self).get_context_data(form, **kwargs) - if hasattr(form, "extra_form_modals"): - context["extra_form_modals"] = form.extra_form_modals + + context["extra_form_modals"] = form.extra_form_modals \ + if hasattr(form, "extra_form_modals") else EXTRA_FORM_MODALS open_item_id = self.request.GET.get('open_item', None) if open_item_id and self.model and \ |