summaryrefslogtreecommitdiff
path: root/ishtar_common/data_importer.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-02-11 11:07:51 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-02-19 14:45:57 +0100
commit4466c5c765dccd23b545c3d1c31449d52a2208cb (patch)
treec248a78408e61c47228ce877991807e1d6ceb39e /ishtar_common/data_importer.py
parentd306ba05c44f9010551ecf74efe4d4334b7e44b1 (diff)
downloadIshtar-4466c5c765dccd23b545c3d1c31449d52a2208cb.tar.bz2
Ishtar-4466c5c765dccd23b545c3d1c31449d52a2208cb.zip
✨ import GIS: do not create GIS item if the main item is already GIS
Diffstat (limited to 'ishtar_common/data_importer.py')
-rw-r--r--ishtar_common/data_importer.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py
index 04782a56e..e222fa0f3 100644
--- a/ishtar_common/data_importer.py
+++ b/ishtar_common/data_importer.py
@@ -1338,7 +1338,9 @@ class Importer(object):
obj.save()
self._add_to_post_save(obj.__class__, obj.pk, idx_line)
- if self.TYPE == "gis":
+ GeoVectorData = apps.get_model("ishtar_common", "GeoVectorData")
+ if self.TYPE == "gis" and not isinstance(obj, GeoVectorData):
+ # create GIS data and attach to the created object if the object is not GIS
if not obj and not self.c_errors:
self.c_errors = True
self.errors.append(
@@ -1349,7 +1351,6 @@ class Importer(object):
)
)
return
-
content_type = ContentType.objects.get(
app_label=obj.__class__._meta.app_label,
model=obj.__class__.__name__.lower()
@@ -1358,7 +1359,6 @@ class Importer(object):
"source_id": obj.pk,
"source_content_type": content_type,
})
- GeoVectorData = apps.get_model("ishtar_common", "GeoVectorData")
item = None
created = False
if "import_key" in geodata: