From a3fdb47d0ee424c65f4f73c2a679cde72ff27907 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 30 Nov 2023 18:22:18 +0100 Subject: 🐛 GIS imports - allow XLS and ODS format (refs #5669) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/forms_common.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'ishtar_common/forms_common.py') diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 4065e1fa3..7ca808929 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -462,7 +462,7 @@ class NewImportGISForm(BaseImportForm): if value: try: ext = value.name.lower().split(".")[-1] - if ext not in ("zip", "gpkg", "csv"): + if ext not in ["zip", "gpkg", "csv", "ods", "xls", "xlsx", "xlsm"]: raise forms.ValidationError("") if ext == "zip": zip_file = zipfile.ZipFile(value) @@ -479,16 +479,14 @@ class NewImportGISForm(BaseImportForm): except forms.ValidationError: raise forms.ValidationError( _( - "GIS file must be a zip containing a ShapeFile or GeoPackage file." + "GIS file must be a table or a zip containing a ShapeFile or GeoPackage file." ) ) return value def clean(self): data = super().clean() - types = ["zip", "gpkg", "csv"] - if settings.USE_LIBREOFFICE: - types += [".ods", ".xls", ".xlsx", ".xlsm"] + types = [".zip", ".gpkg", ".csv", ".ods", ".xls", ".xlsx", ".xlsm"] self._clean_imported_file(types=types) return data -- cgit v1.2.3