summaryrefslogtreecommitdiff
path: root/ishtar_common/models_common.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-10-14 12:43:27 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:23:19 +0100
commit1a7c25095e39a0b666922f5c602906492e58e390 (patch)
tree6f1201cd6916342dc6d1ca62720933e088e669f6 /ishtar_common/models_common.py
parent0d93d19602f6796e2a8beef331721c704b3f8e1f (diff)
downloadIshtar-1a7c25095e39a0b666922f5c602906492e58e390.tar.bz2
Ishtar-1a7c25095e39a0b666922f5c602906492e58e390.zip
Fix main_geodata association test
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r--ishtar_common/models_common.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index 1818c79f6..6330742a3 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -2724,8 +2724,7 @@ class GeographicItem(models.Model):
using=using,
update_fields=update_fields,
)
- if self.main_geodata and not self.geodata.filter(pk=self.main_geodata.pk) and\
- self.main_geodata.pk not in self._geodata:
+ if self.main_geodata and not self.geodata.filter(pk=self.main_geodata.pk).count():
self.geodata.add(self.main_geodata)
elif not self.main_geodata and self.geodata.count():
# arbitrary associate the first to geodata