From d0d146cc099bfe2d58a8c8ec6e57096661d1fdcb Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 13 Nov 2023 18:55:30 +0100 Subject: ⚡️ improve parcel post-treatments - add timestamp to prevent multiple geo and cached_label edition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/models_common.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'ishtar_common/models_common.py') 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): -- cgit v1.2.3