From f4eceb80557e2141e8535cc1b555c1a72e3e8ddd Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 25 Jun 2024 18:58:44 +0200 Subject: ✨ Notices - Town: add old town, new town reference on notices (refs #5380, #5732) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/models_common.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'ishtar_common/models_common.py') diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index ae4b5a64b..adc6ca9eb 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -3483,7 +3483,17 @@ class Town(GeographicItem, Imported, DocumentItem, MainItem, models.Model): for area in self.areas.all(): label.append(" - ") label.append(area.full_label) - return " ".join(label) + label = " ".join(label) + if self.children.count(): + label += str(_(", old town of ")) + " ; ".join([ + "{label} ({code})".format(label=p.name, code=p.numero_insee) + if p.numero_insee else p.name for p in self.children.all() + ]) + return label + + @property + def detail_label(self): + return self.label_with_areas def generate_geo(self, force=False): force = self.generate_limit(force=force) -- cgit v1.2.3