diff options
-rw-r--r-- | ishtar_common/utils.py | 15 |
1 files changed, 9 insertions, 6 deletions
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 |