From 4fd4a7ede4aecc9b77cfeb80b91bb4593c2ba026 Mon Sep 17 00:00:00 2001 From: QuentinAndre Date: Mon, 26 Jul 2021 20:30:30 +0200 Subject: all in jquery and get_geo_items fixes --- ishtar_common/models_common.py | 10 +++++----- .../templates/ishtar/blocks/sheet_geo_items.html | 23 +++++++++++----------- .../templates/ishtar/blocks/sheet_simple_map.html | 14 ++++++------- 3 files changed, 23 insertions(+), 24 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 4691de69c..7ee508a00 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -2871,16 +2871,16 @@ class GeoItem(models.Model): dict["geometry"]["coordinates"] = list_coords else: dict["geometry"]["type"] = "Point" - if self.multi_polygon: - dict["geometry"]["coordinates"] = self.convert_coordinates( - self.multi_polygon.centroid, rounded - ) - else: + if self.point_2d: try: x, y = self.display_coordinates dict["geometry"]["coordinates"] = [x, y] except ValueError: dict["geometry"]["coordinates"] = [] + else: + dict["geometry"]["coordinates"] = self.convert_coordinates( + self.multi_polygon.centroid, rounded + ) return dict def convert_coordinates(self, point_2d, rounded): diff --git a/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html b/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html index 9b485de15..36fbabfcf 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html @@ -24,18 +24,17 @@ -- cgit v1.2.3