summaryrefslogtreecommitdiff
path: root/archaeological_context_records/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_context_records/models.py')
-rw-r--r--archaeological_context_records/models.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index 97a629d05..55b101acc 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -23,10 +23,9 @@ import uuid
from django.apps import apps
from django.conf import settings
from django.contrib.gis.db import models
-from django.contrib.gis.geos import Point
from django.contrib.postgres.indexes import GinIndex
from django.contrib.sites.models import Site
-from django.db import connection
+from django.db import connection, IntegrityError, transaction
from django.db.models import Q
from django.db.models.signals import post_delete, post_save, m2m_changed
from django.urls import reverse
@@ -458,11 +457,15 @@ class GeographicSubTownItem(GeoItem):
return
if not q_geodata_current_town.filter(source_id=town.id).count():
- self.geodata.add(town.main_geodata)
+ try:
+ # multiple save, post treatments can cause synchronous add
+ with transaction.atomic():
+ self.geodata.add(town.main_geodata)
+ except IntegrityError:
+ pass
if save:
- self.skip_history_when_saving = True
- self._no_move = True
- self.save()
+ post_save_geo(self.__class__, instance=self, created=False,
+ update_fields=False, raw=False, using="default")
else:
return True