From fc0e811f9f5042fe72b91db4548142f5f2d4e1df Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 17 Jun 2025 18:06:46 +0200 Subject: ✨ Media exporter: export action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/models_common.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'ishtar_common/models_common.py') diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 0c22b8e7f..e749580f4 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -67,7 +67,7 @@ from simple_history.signals import ( from ishtar_common.data_importer import post_importer_action, ImporterError from ishtar_common.model_managers import TypeManager from ishtar_common.model_merging import merge_model_objects -from ishtar_common.models_imports import Import +from ishtar_common.models_imports import Import, MediaExporter from ishtar_common.templatetags.link_to_window import simple_link_to_window from ishtar_common.utils import ( cached_label_changed, @@ -854,7 +854,19 @@ class TemplateItem: for template in q.all(): urlname = "generate-document" templates.append( - (template.name, reverse(urlname, args=[template.slug, self.pk])) + (template.name, reverse(urlname, args=[template.slug, self.pk]), + template.get_icon()) + ) + templates += self.get_media_exporters(request) + return templates + + def get_media_exporters(self, request): + templates = [] + for media_exporter in MediaExporter.get_available(self.__class__, request): + templates.append( + (media_exporter.name, + reverse("export-media", args=[media_exporter.slug, self.pk]), + "fa fa-file-archive-o") ) return templates -- cgit v1.2.3