summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py12
1 files changed, 12 insertions, 0 deletions
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,)