summaryrefslogtreecommitdiff
path: root/ishtar_common/wizards.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2021-10-27 11:55:34 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:20:59 +0100
commit183c1422d978e2b1cbb1d47e0a024dcee57ae3f9 (patch)
treecc39c3e69039af5bc7854602a4ec9c956e0b4316 /ishtar_common/wizards.py
parent62e05e799962d810804d0cd5f8d377ac8b434a01 (diff)
downloadIshtar-183c1422d978e2b1cbb1d47e0a024dcee57ae3f9.tar.bz2
Ishtar-183c1422d978e2b1cbb1d47e0a024dcee57ae3f9.zip
Syndication - search UI
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r--ishtar_common/wizards.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py
index a22901953..2c2d4f6f9 100644
--- a/ishtar_common/wizards.py
+++ b/ishtar_common/wizards.py
@@ -100,6 +100,8 @@ EXTRA_FORM_MODALS = ["container", "warehouse", "person", "organization"]
class IshtarWizard(NamedUrlWizardView):
+ model = None
+
def get_form_kwargs(self, step=None):
kwargs = super(IshtarWizard, self).get_form_kwargs(step)
if (
@@ -117,6 +119,18 @@ class IshtarWizard(NamedUrlWizardView):
if hasattr(form, "extra_form_modals")
else EXTRA_FORM_MODALS
)
+ if (
+ self.model
+ and "pk" in form.fields
+ and self.request.session.get("EXTERNAL_SOURCES", {})
+ ):
+ model_name = f"{self.model._meta.app_label}-{self.model.__name__.lower()}"
+ context["external_sources"] = [
+ source.split("-")
+ for source in self.request.session["EXTERNAL_SOURCES"]
+ if model_name in self.request.session["EXTERNAL_SOURCES"][source]
+ ]
+ form.fields["pk"].widget.external_sources = context["external_sources"]
open_item_id = self.request.GET.get("open_item", None)
if open_item_id and self.model and getattr(self.model, "SHOW_URL", None):