summaryrefslogtreecommitdiff
path: root/ishtar_common/models_common.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2023-11-13 18:55:30 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2023-11-14 16:57:37 +0100
commitd0d146cc099bfe2d58a8c8ec6e57096661d1fdcb (patch)
tree1007a19ed094bb463a9234909d84412a379a3c9c /ishtar_common/models_common.py
parent1d1fd6c794c8ca8e758fc416b43e0f881136057f (diff)
downloadIshtar-d0d146cc099bfe2d58a8c8ec6e57096661d1fdcb.tar.bz2
Ishtar-d0d146cc099bfe2d58a8c8ec6e57096661d1fdcb.zip
⚡️ improve parcel post-treatments - add timestamp to prevent multiple geo and cached_label edition
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r--ishtar_common/models_common.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index 2074aa523..0345eada2 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -1080,6 +1080,8 @@ class Imported(models.Model):
imports = models.ManyToManyField(
Import, blank=True, related_name="imported_%(app_label)s_%(class)s"
)
+ timestamp_geo = models.IntegerField(_("Timestamp geo"), null=True, blank=True)
+ timestamp_label = models.IntegerField(_("Timestamp label"), null=True, blank=True)
class Meta:
abstract = True
@@ -3329,6 +3331,8 @@ class MainItem(ShortMenuItem, SerializeItem):
rel.update(need_update=True)
continue
for item in getattr(self, down_model).all():
+ if hasattr(self, "_timestamp"):
+ item._timestamp = self._timestamp
if hasattr(item, "cached_label_changed"):
item.cached_label_changed()
if hasattr(item, "main_geodata"):
@@ -3417,10 +3421,13 @@ class MainItem(ShortMenuItem, SerializeItem):
def regenerate_external_id(self):
if not hasattr(self, "external_id"):
return
+ try:
+ self.external_id = ""
+ self.auto_external_id = True
+ except AttributeError:
+ return
self.skip_history_when_saving = True
self._no_move = True
- self.external_id = ""
- self.auto_external_id = True
self.save()
def cached_label_changed(self):