diff options
-rw-r--r-- | CHANGES.md | 6 | ||||
-rw-r--r-- | ishtar_common/models_common.py | 10 |
2 files changed, 14 insertions, 2 deletions
diff --git a/CHANGES.md b/CHANGES.md index fa1448a4a..87d8e869b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,16 +3,18 @@ title: Ishtar changelog date: 2022-10-17 --- +### Features ### +- Geodata: display first item associated as a name when no name is provided ### Bug fix ### -- Geodata import: +- Geodata import: fix total number evaluation on imports v4.0.24 - 2022-10-27 -------------------- ### Bug fix ### -- Geodata import: fix total number evaluation on imports +- Geodata save: transactions to limit deadlocks v4.0.23 - 2022-10-26 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 |