From dd0a0f87251f4b688ff8a8f6098e5f8470371e0a Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 5 Dec 2022 12:17:11 +0100 Subject: Migration v4: disable M2M post treatment --- example_project/settings.py | 2 ++ ishtar_common/models_common.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3