diff options
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r-- | ishtar_common/models_common.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 0c763965b..a7dc8464e 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -2930,6 +2930,23 @@ def town_child_changed(sender, **kwargs): m2m_changed.connect(town_child_changed, sender=Town.children.through) +def geotown_attached_changed(sender, **kwargs): + # manage associated geoitem + profile = get_current_profile() + if not profile.mapping: + return + instance = kwargs.get("instance", None) + model = kwargs.get("model", None) + pk_set = kwargs.get("pk_set", None) + action = kwargs.get("action", None) + if not instance or not model or not hasattr(instance, "post_save_geo"): + return + + instance._post_save_geo_ok = False + if action in ("post_add", "post_remove", "post_clear"): + instance.post_save_geo(save=True) + + class Address(BaseHistorizedItem): FIELDS = ( "address", |