summaryrefslogtreecommitdiff
path: root/archaeological_warehouse/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2023-03-21 22:27:58 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2023-04-03 12:48:00 +0200
commita847ded15c80dfa0b16dee5c1ea109da06af7b34 (patch)
treee981f729ceae0a4444105323ed3ad16b9a7a9bc6 /archaeological_warehouse/models.py
parent05911c88dacbc5dd974fa5697dd08e9ab1d35d1d (diff)
downloadIshtar-a847ded15c80dfa0b16dee5c1ea109da06af7b34.tar.bz2
Ishtar-a847ded15c80dfa0b16dee5c1ea109da06af7b34.zip
Load task refactoring - manage external_id regen with tasks - cascade update from warehouse to containers (refs #5432) - containers manage history
Diffstat (limited to 'archaeological_warehouse/models.py')
-rw-r--r--archaeological_warehouse/models.py9
1 files changed, 5 insertions, 4 deletions
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()