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.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'ishtar_common/models.py') diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 579c3c644..11ac75876 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -2132,6 +2132,13 @@ if settings.USE_LIBREOFFICE: ("xlsx", _("XLSX")), ] +EXPORT_FORMATS_ICONS = { + "docx": "fa fa-file-word-o", + "html": "fa fa-code", + "pdf": "fa fa-file-pdf-o", + "xlsx": "fa fa-file-excel-o", +} + EXPORT_FORMATS_DICT = dict(EXPORT_FORMATS) @@ -2187,6 +2194,11 @@ class DocumentTemplate(models.Model): def __str__(self): return self.name + def get_icon(self): + if not self.export_format or self.export_format not in EXPORT_FORMATS_ICONS: + return "fa fa-file-text-o" + return EXPORT_FORMATS_ICONS[self.export_format] + def natural_key(self): return (self.slug,) -- cgit v1.2.3