summaryrefslogtreecommitdiff
path: root/ishtar_common/utils.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-01-10 00:26:07 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-01-10 00:26:07 +0100
commitc0f14049777002bf0849f04dabc99a6bc66de295 (patch)
tree777c2f1bcfc1cde0056a64b04d0ee322948ade56 /ishtar_common/utils.py
parent229a5559e9933ea76020963ca3778906d39279d4 (diff)
parent1191cb323ca087ea05d5f58acb555b8e2d266801 (diff)
downloadIshtar-c0f14049777002bf0849f04dabc99a6bc66de295.tar.bz2
Ishtar-c0f14049777002bf0849f04dabc99a6bc66de295.zip
Merge branch 'master' into v0.9
Conflicts: archaeological_files/migrations/0014_auto__add_field_file_requested_operation_type__add_field_file_organiza.py
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r--ishtar_common/utils.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py
index 44112bca3..9b3c85694 100644
--- a/ishtar_common/utils.py
+++ b/ishtar_common/utils.py
@@ -60,11 +60,18 @@ def cached_label_changed(sender, **kwargs):
and instance._cached_label_checked:
return
instance._cached_label_checked = True
- lbl = instance._generate_cached_label()
- if lbl != instance.cached_label:
+ cached_labels = ['cached_label']
+ if hasattr(sender, 'CACHED_LABELS'):
+ cached_labels = sender.CACHED_LABELS
+ changed = False
+ for cached_label in cached_labels:
+ lbl = getattr(instance, '_generate_' + cached_label)()
+ if lbl != getattr(instance, cached_label):
+ setattr(instance, cached_label, lbl)
+ changed = True
+ if changed:
if hasattr(instance, '_cascade_change') and instance._cascade_change:
instance.skip_history_when_saving = True
- instance.cached_label = lbl
instance.save()
if hasattr(instance, '_get_associated_cached_labels'):
for item in instance._get_associated_cached_labels():