summaryrefslogtreecommitdiff
path: root/ishtar_common/models_common.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-03-20 16:02:51 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-03-20 16:07:40 +0100
commitac3adb815091e4157bce75542f40e12257add364 (patch)
tree119f98a5defa41b55e534d8792207557d393e378 /ishtar_common/models_common.py
parentcaf3138871b7cba6d76a83d4d7ae5123fddf1b8e (diff)
downloadIshtar-ac3adb815091e4157bce75542f40e12257add364.tar.bz2
Ishtar-ac3adb815091e4157bce75542f40e12257add364.zip
🐛 sheet geo: fix label on map view for markers (refs #6234)
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r--ishtar_common/models_common.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index d7b7c3e21..96eb26bbf 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -2662,29 +2662,31 @@ class GeoVectorData(Imported, OwnPerms):
@classmethod
def _get_geo_item_list(cls, q, current_geodata, url, precision, rounded):
- collection_id = []
- items_id = []
- q = q.values("main_geodata", "id")
+ collection_id, items = [], []
+ q = q.values("main_geodata", "id", "cached_label")
for item in q.distinct().all():
geodata_id = item["main_geodata"]
if geodata_id not in current_geodata:
collection_id.append(geodata_id)
- items_id.append(item["id"])
+ items.append((item["id"], item["cached_label"]))
current_geodata.append(geodata_id)
collection = []
for idx in range(len(collection_id)):
geo = json.loads(GeoVectorData.objects.get(pk=collection_id[idx]).geojson)
geo_type = geo.get("type", None)
- url_geo = url.format(items_id[idx])
+ current_id, label = items[idx]
+ url_geo = url.format(current_id)
if geo_type == "FeatureCollection":
for feat in geo["features"]:
if "properties" in feat:
feat["properties"]["url"] = url_geo
+ feat["properties"]["name"] = label
collection += geo["features"]
elif geo_type:
if "properties" in geo:
geo["properties"]["url"] = url_geo
+ geo["properties"]["name"] = label
collection.append(geo)
if not precision and rounded: