diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-10-22 12:12:34 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-10-22 12:12:34 +0200 | 
| commit | 06acf42e0b0da30fbcc052f234ae64e94f0379c7 (patch) | |
| tree | 3ec1bcbbdf54d7e339a9938935b9162dcbb1b818 | |
| parent | 552d6e184a091566a16b7a207f4a6af4dcf7d27c (diff) | |
| download | Ishtar-06acf42e0b0da30fbcc052f234ae64e94f0379c7.tar.bz2 Ishtar-06acf42e0b0da30fbcc052f234ae64e94f0379c7.zip  | |
Force cache regeneration on rollback
| -rw-r--r-- | ishtar_common/models.py | 2 | ||||
| -rw-r--r-- | ishtar_common/utils.py | 5 | 
2 files changed, 5 insertions, 2 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index c9be5b086..3453a53c5 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -795,6 +795,8 @@ class BaseHistorizedItem(Imported):                      pk=new_item.history_modifier_id)              except User.ObjectDoesNotExist:                  pass +            # force label regeneration +            self._cached_label_checked = False              self.save()          except:              raise HistoryError(u"The rollback has failed.") diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index d72b8b6ba..44112bca3 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -56,12 +56,13 @@ def cached_label_changed(sender, **kwargs):      if not kwargs.get('instance'):          return      instance = kwargs.get('instance') -    if hasattr(instance, '_cached_label_checked'): +    if hasattr(instance, '_cached_label_checked') \ +            and instance._cached_label_checked:          return      instance._cached_label_checked = True      lbl = instance._generate_cached_label()      if lbl != instance.cached_label: -        if hasattr(instance, '_cascade_change'): +        if hasattr(instance, '_cascade_change') and instance._cascade_change:              instance.skip_history_when_saving = True          instance.cached_label = lbl          instance.save()  | 
