From ced53a87545352e43c0c2f71103f706d8868aaf7 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 24 Oct 2025 15:05:28 +0200 Subject: 🐛 ✨ person, organization tables: fix and optimize town name and person type list (refs #6441) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/models_common.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ishtar_common/models_common.py') diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index ce31cb974..75aa6c986 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -4201,6 +4201,9 @@ class Address(BaseHistorizedItem): alt_address_is_prefered = models.BooleanField( _("Alternative address is prefered"), default=False ) + cached_town = models.TextField( + _("Cached town"), blank=True, default="" + ) history = HistoricalRecords(inherit=True) SUB_ADDRESSES = [] ALT_NAMES = { @@ -4394,6 +4397,11 @@ class Address(BaseHistorizedItem): def address_lbl_list(self): return self.address_lbl(list=True) + def _generate_cached_town(self): + if self.precise_town: + return self.precise_town.name + return self.town or "" + class Merge(models.Model): merge_key = models.TextField(_("Merge key"), blank=True, null=True) -- cgit v1.2.3