summaryrefslogtreecommitdiff
path: root/ishtar_common/views.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2023-10-19 13:32:28 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2024-02-05 10:51:52 +0100
commit0e87aae64761766e8f74328a8e68e079062aa0af (patch)
tree8a77c4f2afa4fcab3d24604633e8fe5a55a7d56d /ishtar_common/views.py
parente6dab88f74f0f13ab047b4f0059c7f1e469118f3 (diff)
downloadIshtar-0e87aae64761766e8f74328a8e68e079062aa0af.tar.bz2
Ishtar-0e87aae64761766e8f74328a8e68e079062aa0af.zip
✨ imports: manage ods, xls and xlsx
Convert them to CSV and store the resulting file in a specific field.
Diffstat (limited to 'ishtar_common/views.py')
-rw-r--r--ishtar_common/views.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/ishtar_common/views.py b/ishtar_common/views.py
index aec8fa9f4..8f8ecb5a6 100644
--- a/ishtar_common/views.py
+++ b/ishtar_common/views.py
@@ -2146,7 +2146,7 @@ class ImportGroupDeleteView(IshtarMixin, LoginRequiredMixin, DeleteView):
class ImportCSVView(IshtarMixin, LoginRequiredMixin, TemplateView):
template_name = "ishtar/blocks/view_import_csv.html"
ATTRIBUTES = {
- "source": "imported_file",
+ "source": "get_imported_values",
"error": "error_file",
"result": "result_file",
"match": "match_file"
@@ -2169,6 +2169,8 @@ class ImportCSVView(IshtarMixin, LoginRequiredMixin, TemplateView):
self.import_item = q.all()[0]
attribute = self.ATTRIBUTES[kwargs["target"]]
self.csv_file = getattr(self.import_item, attribute)
+ if callable(self.csv_file):
+ self.csv_file = self.csv_file()
if not self.csv_file:
raise Http404()
return super().get(request, *args, **kwargs)