summaryrefslogtreecommitdiff
path: root/ishtar_common/models_common.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r--ishtar_common/models_common.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index 779af635b..dc35cade2 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -2210,6 +2210,16 @@ class GeoVectorData(Imported, OwnPerms):
def __str__(self):
name = self.name
+ if not name or name == "-":
+ for related_model in self.RELATED_MODELS:
+ q = getattr(self, related_model)
+ cached_label_key = "cached_label"
+ if getattr(q.model, "GEO_LABEL", None):
+ cached_label_key = q.model.GEO_LABEL
+ if q.count(): # arbitrary return the first item
+ name = str(q.values_list(cached_label_key, flat=True).all()[0])
+ break
+
if self.data_type:
name += f" ({str(self.data_type).lower()})"
return name