diff options
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r-- | ishtar_common/utils.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index 55e3a3a75..20957c43e 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -476,8 +476,11 @@ def post_save_point(sender, **kwargs): if not kwargs.get('instance'): return instance = kwargs.get('instance') - point = None - point_2d = None + point = instance.point + point_2d = instance.point_2d + from ishtar_common.models import get_current_profile # not clean but utils + # must be loaded before models + profile = get_current_profile() if instance.x and instance.y and \ instance.spatial_reference_system and \ instance.spatial_reference_system.auth_name == 'EPSG' and \ @@ -488,6 +491,8 @@ def post_save_point(sender, **kwargs): point = convert_coordinates_to_point( instance.x, instance.y, instance.z, srid=instance.spatial_reference_system.srid) + elif profile.use_town_for_geo: + point_2d = instance.get_town_centroid() if point_2d != instance.point_2d or point != instance.point: instance.point = point instance.point_2d = point_2d |