diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-10-08 10:53:50 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-10-08 10:53:50 +0200 |
commit | 347a069fcd2274f5ae2c31dfde35b65fa492257a (patch) | |
tree | 0664cc84fc29c98af096dce8d0acc53a09a0e35e /ishtar_common/models.py | |
parent | 2f526ba22f183ef744cfd7ac7284585f8b318d95 (diff) | |
download | Ishtar-347a069fcd2274f5ae2c31dfde35b65fa492257a.tar.bz2 Ishtar-347a069fcd2274f5ae2c31dfde35b65fa492257a.zip |
✨ document templates: manage export in PDF, HTML, xlsx, docx using LO unoconv
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 73f140625..c7fe7be8a 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -2057,11 +2057,23 @@ class Dashboard(object): return v -EXPORT_FORMATS = [] +EXPORT_FORMATS = [("", "---")] +EXPORT_FORMATS_CONTENT_TYPE = { + "xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + "pdf": "application/pdf", + "html": "text/html", + "odt": "application/vnd.oasis.opendocument.text", + "ods": "application/vnd.oasis.opendocument.spreadsheet", +} if settings.USE_LIBREOFFICE: - EXPORT_FORMATS.append(("xlsx", _("XLSX"))) - EXPORT_FORMATS.append(("pdf", _("PDF"))) + EXPORT_FORMATS = [ + ("docx", _("DOCX")), + ("html", _("HTML")), + ("pdf", _("PDF")), + ("xlsx", _("XLSX")), + ] EXPORT_FORMATS_DICT = dict(EXPORT_FORMATS) @@ -2124,7 +2136,7 @@ class DocumentTemplate(models.Model): def clean(self): if self.for_labels and not self.label_per_page: raise ValidationError( - _("For label template, you must provide " "number of label per page.") + _("For label template, you must provide number of label per page.") ) def generate_label_template(self): |