summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2024-02-15 15:58:23 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2024-04-16 16:41:51 +0200
commit3c5dac4fae65cfa0ce81e948318bdc4d9bd3af49 (patch)
treea2caef3fae5f2c84f01eb4ebcc96a32b02a5ee2c /ishtar_common/models.py
parentb0686329d8d722070ab6304f44bcc256d04b50ed (diff)
downloadIshtar-3c5dac4fae65cfa0ce81e948318bdc4d9bd3af49.tar.bz2
Ishtar-3c5dac4fae65cfa0ce81e948318bdc4d9bd3af49.zip
🗃️ biographical notes - model, admin: add organization
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py16
1 files changed, 14 insertions, 2 deletions
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")),