From 704b3d7e865289d1588ac590bef97b2d8ebd5bea Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 13 Feb 2019 23:56:20 +0100 Subject: Fix post sav for point (precise before town) --- ishtar_common/utils.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'ishtar_common/utils.py') diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index d8650f098..25cc8f84c 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -509,12 +509,6 @@ def post_save_geo(sender, **kwargs): instance.point_2d = convert_coordinates_to_point( instance.point.x, instance.point.y, srid=current_point.srid) - elif not point_2d and profile.use_town_for_geo: # try to get from parent - point_2d = instance.get_town_centroid() - if point_2d != instance.point_2d: - instance.point_2d = point_2d - instance.point_source = 'T' # town - modified = True elif instance.x and instance.y and \ instance.spatial_reference_system and \ instance.spatial_reference_system.auth_name == 'EPSG' and \ @@ -535,6 +529,15 @@ def post_save_geo(sender, **kwargs): instance.point_2d = point_2d instance.point_source = 'P' modified = True + elif not point_2d and profile.use_town_for_geo: # try to get from parent + point_2d = instance.get_town_centroid() + if point_2d != instance.point_2d: + instance.point_2d = point_2d + instance.point_source = 'T' # town + modified = True + + if not hasattr(instance, 'multi_polygon'): + return if instance.multi_polygon and not instance.multi_polygon_source: # should be a db source -- cgit v1.2.3