summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-05 12:17:11 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:23:20 +0100
commitdd0a0f87251f4b688ff8a8f6098e5f8470371e0a (patch)
tree15bbeb9d87dc8ad3924288244da924e65dd26d6b
parentdc83ecb803367927649ac7d31b525c43fcaff7de (diff)
downloadIshtar-dd0a0f87251f4b688ff8a8f6098e5f8470371e0a.tar.bz2
Ishtar-dd0a0f87251f4b688ff8a8f6098e5f8470371e0a.zip
Migration v4: disable M2M post treatment
-rw-r--r--example_project/settings.py2
-rw-r--r--ishtar_common/models_common.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/example_project/settings.py b/example_project/settings.py
index 4830abe42..33372bd5d 100644
--- a/example_project/settings.py
+++ b/example_project/settings.py
@@ -262,6 +262,8 @@ ISHTAR_SLUGS = {
"document-publisher": ["publisher"],
}
+ISHTAR_MIGRATE_V4 = False
+
SRID = 4326 # WGS84 - World
SURFACE_SRID = 4326 # WGS84 - World
ENCODING = "windows-1252"
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index ebee974ff..1db38fbb5 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -2656,6 +2656,9 @@ def geodata_attached_remove(model, instance, pk_set=None, clear=False):
def geodata_attached_changed(sender, **kwargs):
+ if getattr(settings, "ISHTAR_MIGRATE_V4", False):
+ # disable on first migration
+ return
# manage main geoitem and cascade association
profile = get_current_profile()
if not profile.mapping:
@@ -2672,7 +2675,7 @@ def geodata_attached_changed(sender, **kwargs):
instance_pk = instance.pk
instance = model.objects.get(pk=list(pk_set)[0])
model = GeoVectorData
- pk_set = set([instance_pk])
+ pk_set = {instance_pk}
if action == "post_add":
geodata_attached_post_add(model, instance, pk_set)