From f296333a87085ee0e04a0f4fbfc207c112f17bce Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 28 Oct 2016 20:26:31 +0200 Subject: Force regeneration of cached labels when add M2M or changing ids --- archaeological_finds/models.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'archaeological_finds/models.py') diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py index 5799d0e9a..aa5eacc30 100644 --- a/archaeological_finds/models.py +++ b/archaeological_finds/models.py @@ -269,6 +269,7 @@ class BaseFind(BaseHistorizedItem, OwnPerms): self.auto_external_id = True self.external_id = external_id if updated: + self._cached_label_checked = False self.save() return returned @@ -653,6 +654,7 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): self.auto_external_id = True self.external_id = external_id if updated: + self._cached_label_checked = False self.save() return @@ -671,6 +673,7 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): self.index = q.aggregate(Max('index'))['index__max'] + 1 else: self.index = 1 + self._cached_label_checked = False self.save() for base_find in self.base_finds.filter( context_record__operation__pk__isnull=False).all(): @@ -689,6 +692,7 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): modified = True if modified: base_find.skip_history_when_saving = True + base_find._cached_label_checked = False base_find.save() # if not base_find.material_index: # idx = BaseFind.objects\ -- cgit v1.2.3