From a847ded15c80dfa0b16dee5c1ea109da06af7b34 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 21 Mar 2023 22:27:58 +0100 Subject: Load task refactoring - manage external_id regen with tasks - cascade update from warehouse to containers (refs #5432) - containers manage history --- archaeological_warehouse/models.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'archaeological_warehouse/models.py') diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 00500bdcf..f88631d80 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -285,11 +285,13 @@ class Warehouse( MODEL = "warehouse" SHOW_URL = "show-warehouse" DELETE_URL = "delete-warehouse" + DOWN_MODEL_UPDATE = ["containers", "responsibilities"] TABLE_COLS = ["name", "warehouse_type__label", "cached_town_label"] COL_LABELS = { "warehouse_type__label": _("Type"), "cached_town_label": _("Town"), } + INITIAL_VALUES = ["name", "slug"] NEW_QUERY_ENGINE = True BASE_SEARCH_VECTORS = [ SearchVectorConfig("name"), @@ -320,7 +322,6 @@ class Warehouse( ), } GEO_LABEL = "name" - DOWN_MODEL_UPDATE = ["containers"] FORCE_CASCADE_UPDATE = True CACHED_LABELS = ["cached_town_label"] @@ -671,9 +672,8 @@ class Warehouse( self.external_id = external_id updated = True if updated: - self.skip_history_when_saving = True + self.no_post_process() self._cached_label_checked = False - self.force_update = True self.save() @@ -1458,6 +1458,7 @@ class Container( ): if child.location != parent.location: child.location = parent.location + child.skip_history_when_saving = True child.save() cls._change_child_location(child) @@ -1926,7 +1927,7 @@ class Container( def save(self, *args, **kwargs): self.pre_save() - super(Container, self).save(*args, **kwargs) + super().save(*args, **kwargs) self._change_child_location(self) updated = False updated += self._prevent_parent_infinite_loop() -- cgit v1.2.3