summaryrefslogtreecommitdiff
path: root/ishtar_common/models_common.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-10-24 15:05:28 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-10-24 18:40:45 +0200
commit966b7443e1d2001d69ca5b406e2b99969adc67ca (patch)
tree028ca97674b74ebe352ecfb54e9c13f69aa0d583 /ishtar_common/models_common.py
parente6fc3223057ff1c79ad15f2f14d66dc195cffacd (diff)
downloadIshtar-966b7443e1d2001d69ca5b406e2b99969adc67ca.tar.bz2
Ishtar-966b7443e1d2001d69ca5b406e2b99969adc67ca.zip
🐛 ✨ person, organization tables: fix and optimize town name and person type list (refs #6441)
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r--ishtar_common/models_common.py8
1 files changed, 8 insertions, 0 deletions
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)