summaryrefslogtreecommitdiff
path: root/ishtar_common/utils.py
diff options
context:
space:
mode:
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
commit704b3d7e865289d1588ac590bef97b2d8ebd5bea (patch)
treeabe670d976d3b67e04095c54dd8e61ee26cc621b /ishtar_common/utils.py
parent21fc0f481da2f079ae42f21976d32a8bc75ecd05 (diff)
downloadIshtar-704b3d7e865289d1588ac590bef97b2d8ebd5bea.tar.bz2
Ishtar-704b3d7e865289d1588ac590bef97b2d8ebd5bea.zip
Fix post sav for point (precise before town)
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r--ishtar_common/utils.py15
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