summaryrefslogtreecommitdiff
path: root/ishtar_common/wizards.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2023-01-10 13:08:48 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2023-01-12 09:50:56 +0100
commit061edbaac5a37b8e717391c3b7d804a96c041979 (patch)
tree79a9647f9e8563d44d08123dd4844a249001e63a /ishtar_common/wizards.py
parentac839d9481b863c93a9c0f92011118bb581f7c2d (diff)
downloadIshtar-061edbaac5a37b8e717391c3b7d804a96c041979.tar.bz2
Ishtar-061edbaac5a37b8e717391c3b7d804a96c041979.zip
Syndication - export external sources
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r--ishtar_common/wizards.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py
index 8acf1a3ed..d8c789018 100644
--- a/ishtar_common/wizards.py
+++ b/ishtar_common/wizards.py
@@ -48,7 +48,7 @@ from django.template import loader
from django.utils.translation import ugettext_lazy as _
from django.utils.safestring import mark_safe
-from ishtar_common import models
+from ishtar_common import models, models_rest
from ishtar_common.forms import CustomForm, reverse_lazy
from ishtar_common.utils import get_all_field_names, MultiValueDict, put_session_message
@@ -134,8 +134,26 @@ class IshtarWizard(NamedUrlWizardView):
src_id, lbl = source.split("||")
except ValueError:
continue
- url = reverse("search-external", args=[base_model_name, src_id])
- context["external_sources"].append((src_id, lbl, url))
+ q = models_rest.ApiExternalSource.objects.filter(
+ profiles=self.request.user.ishtaruser.current_profile,
+ pk=src_id
+ )
+ if not q.count():
+ continue
+ external_source = q.all()[0]
+ url = reverse("external-search", args=[base_model_name, src_id])
+ export_urls = []
+ for slug, label in external_source.get_exports(model_name):
+ export_urls.append(
+ (label,
+ reverse("external-export",
+ args=[src_id, base_model_name, slug]))
+ )
+ context["external_sources"].append(
+ (src_id, lbl, url, external_source.get_columns(model_name),
+ external_source.get_column_labels(model_name),
+ export_urls)
+ )
form.fields["pk"].widget.external_sources = context["external_sources"]