diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-02-13 23:56:20 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-04-24 19:38:56 +0200 |
commit | 1f0cc9562e412fc9b2eb0c5dd395e3737458fc1d (patch) | |
tree | abe670d976d3b67e04095c54dd8e61ee26cc621b /ishtar_common/utils.py | |
parent | cd4e5de78f1fa221da62e3c8af26372e62d3effc (diff) | |
download | Ishtar-1f0cc9562e412fc9b2eb0c5dd395e3737458fc1d.tar.bz2 Ishtar-1f0cc9562e412fc9b2eb0c5dd395e3737458fc1d.zip |
Fix post sav for point (precise before town)
Diffstat (limited to 'ishtar_common/utils.py')
-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 |