summaryrefslogtreecommitdiff
path: root/archaeological_operations/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r--archaeological_operations/models.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 263aa5f55..90a4043b6 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -198,11 +198,12 @@ class GeographicTownItem(GeoItem):
current_town_geo = None
if q_towns_nb == 1:
current_town_geo = q_towns.all()[0]
- if not q_geodata_town.filter(pk=current_town_geo.pk).count():
- for geo in q_geodata_town.exclude(source_id=current_town_geo.pk).all():
- self.geodata.remove(geo)
- if self.main_geodata == geo:
- self.main_geodata = None
+ for geo in q_geodata_town.exclude(source_id=current_town_geo.pk).all():
+ self.geodata.remove(geo)
+ if self.main_geodata == geo:
+ self.main_geodata = None
+ changed = True
+ if not q_geodata_town.filter(source_id=current_town_geo.pk).count():
self.geodata.add(current_town_geo.main_geodata)
changed = True