From 3c5dac4fae65cfa0ce81e948318bdc4d9bd3af49 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 15 Feb 2024 15:58:23 +0100 Subject: 🗃️ biographical notes - model, admin: add organization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/models.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'ishtar_common/models.py') diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 5858fdb78..d51784b72 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1385,7 +1385,7 @@ class IshtarSiteProfile(models.Model, Cached): ) museum_complete_identifier = models.TextField( _("Find - Complete museum ID"), - default="{{museum_id_prefix}}.{{museum_id}}.{{museum_id_suffix}}", + default="{% if museum_id_prefix %}{{museum_id_prefix}}.{% endif %}{{museum_id}}{% if museum_id_suffix %}.{{museum_id_suffix}}{% endif %}", help_text=_( "Formula to manage cached label. If not set a default formula is used." ), @@ -3244,12 +3244,24 @@ class BiographicalNote(models.Model): biography_format = models.CharField( _("Biography format"), blank=True, default="NO", max_length=2, choices=TEXT_FORMAT ) - person = models.ForeignKey(Person, verbose_name=_("Person"), blank=True, null=True, on_delete=models.SET_NULL) + person = models.ForeignKey(Person, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_("Person")) + organization = models.ForeignKey( + Organization, blank=True, null=True, on_delete=models.SET_NULL, + verbose_name=_("Organization"), + ) + + class Meta: + verbose_name = _("Biographical note") + verbose_name_plural = _("Biographical notes") + ADMIN_SECTION = _("Directory") @property def formatted_biography(self): return text_format(self.biography, self.biography_format) + def __str__(self): + return self.denomination + GDPR_ACTIVITY = ( ("DC", _("Directory consultation")), -- cgit v1.2.3