From 966b7443e1d2001d69ca5b406e2b99969adc67ca 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 96f0f5d86..be3e06848 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -4226,6 +4226,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 = { @@ -4419,6 +4422,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