summaryrefslogtreecommitdiff
path: root/archaeological_context_records
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-05-18 16:24:26 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:20:59 +0100
commitc641fca2bc2bd5c6892b4105325dee99e9da35d6 (patch)
tree5f9012ed94ce2f854d9a349f7264447419cd99d3 /archaeological_context_records
parente39f05ef095d9b74853fa177d8ce2a566478dae2 (diff)
downloadIshtar-c641fca2bc2bd5c6892b4105325dee99e9da35d6.tar.bz2
Ishtar-c641fca2bc2bd5c6892b4105325dee99e9da35d6.zip
Syndication - serialization - display sheet find - 2
Diffstat (limited to 'archaeological_context_records')
-rw-r--r--archaeological_context_records/models.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index ef9e2788e..29e8793dc 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -66,7 +66,7 @@ from ishtar_common.models import (
QuickAction,
RelationsViews,
)
-from ishtar_common.models_common import HistoricalRecords
+from ishtar_common.models_common import HistoricalRecords, SerializeItem
from archaeological_operations.models import (
Operation,
Period,
@@ -98,7 +98,9 @@ post_save.connect(post_save_cache, sender=DatingQuality)
post_delete.connect(post_save_cache, sender=DatingQuality)
-class Dating(models.Model):
+class Dating(models.Model, SerializeItem):
+ SLUG = "dating"
+ SERIALIZE_EXCLUDE = ["find", "context_record"]
uuid = models.UUIDField(default=uuid.uuid4)
period = models.ForeignKey(
Period, verbose_name=_("Period"), on_delete=models.PROTECT
@@ -614,6 +616,10 @@ class ContextRecord(
),
]
SERIALIZE_EXCLUDE = MainItem.SERIALIZE_EXCLUDE + ["contextrecord"]
+ SERIALIZE_PROPERTIES = MainItem.SERIALIZE_PROPERTIES + [
+ "short_label",
+ "town_label_with_areas",
+ ]
history = HistoricalRecords(bases=[HistoryModel])
objects = UUIDModelManager()
@@ -975,6 +981,12 @@ class ContextRecord(
)
@property
+ def town_label_with_areas(self):
+ if not self.town:
+ return ""
+ return self.town.label_with_areas
+
+ @property
def relation_label(self):
return self.label