From 89b1e4a21e80d53be0e28df8723eec36358034f9 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 19 Oct 2023 13:32:28 +0200 Subject: ✨ imports: manage ods, xls and xlsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert them to CSV and store the resulting file in a specific field. --- ishtar_common/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ishtar_common/views.py') 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) -- cgit v1.2.3