diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-10-22 09:47:33 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-10-22 09:47:33 +0200 |
commit | 53888c24ca9dc156e5ffa0dc66e1bf36a00085a0 (patch) | |
tree | f4b6d2c1dd642d37eb786703597f40c69c789119 /ishtar_common/utils.py | |
parent | 4894a53ebb007d80f2a602147481645358ab4ab7 (diff) | |
download | Ishtar-53888c24ca9dc156e5ffa0dc66e1bf36a00085a0.tar.bz2 Ishtar-53888c24ca9dc156e5ffa0dc66e1bf36a00085a0.zip |
Improve cached label regeneration when modifying parent items (refs #3341)
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r-- | ishtar_common/utils.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index 60c3ac7ef..82d4f2caa 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -56,10 +56,17 @@ def cached_label_changed(sender, **kwargs): if not kwargs.get('instance'): return instance = kwargs.get('instance') + if hasattr(instance, '_cached_label_checked'): + return + instance._cached_label_checked = True lbl = instance._generate_cached_label() if lbl != instance.cached_label: + 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(): + cached_label_changed(item.__class__, instance=item) SHORTIFY_STR = ugettext(" (...)") |