diff options
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r-- | ishtar_common/utils.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index 53727b6d3..fc302166b 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -846,6 +846,30 @@ def _post_save_geo(sender, **kwargs): if not instance: return + if getattr(instance, "_post_saved_geo", False): + return + + instance._post_saved_geo = True + + modified = False + if getattr(instance, "post_save_geo", False): + instance.post_save_geo(save=False) + modified = True + + if hasattr(instance, "need_update") and instance.need_update: + instance.need_update = False + modified = True + + if modified: + instance.skip_history_when_saving = True + instance._post_saved_geo = True + instance._cached_label_checked = False + instance.save() + if hasattr(instance, "cascade_update"): + instance.cascade_update() + cache_key, __ = get_cache(sender, ["post_save_geo", instance.pk]) + cache.set(cache_key, None, settings.CACHE_TASK_TIMEOUT) + return # TODO to delete |