summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2026-03-27 11:58:51 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2026-03-27 12:19:09 +0100
commite0e01265db6b6558d520b8c12a841f62e7f2b2c3 (patch)
tree3e7ee26d641d20e9f2668f450742783c1bf94e18 /archaeological_operations
parent6ebe53884bda07026d7eb1cfb7d093d95465e8b3 (diff)
downloadIshtar-e0e01265db6b6558d520b8c12a841f62e7f2b2c3.tar.bz2
Ishtar-e0e01265db6b6558d520b8c12a841f62e7f2b2c3.zip
🗃️ sites - models: add many fields for heritage management
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/models.py91
1 files changed, 84 insertions, 7 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 138b8d91b..9d9e227b0 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -40,6 +40,7 @@ from ishtar_common.utils import gettext_lazy as _, pgettext_lazy, get_generated_
from ishtar_common.models import (
Area,
+ Author,
BaseHistorizedItem,
DashboardFormItem,
Document,
@@ -210,6 +211,32 @@ post_save.connect(post_save_cache, sender=CulturalAttributionType)
post_delete.connect(post_save_cache, sender=CulturalAttributionType)
+class HeritageInterestType(HierarchicalType):
+ order = models.IntegerField(_("Order"), default=10)
+
+ class Meta:
+ verbose_name = _("Heritage interest type")
+ verbose_name_plural = _("Heritage interest types")
+ ordering = ("order", "label")
+
+
+post_save.connect(post_save_cache, sender=HeritageInterestType)
+post_delete.connect(post_save_cache, sender=HeritageInterestType)
+
+
+class HeritageAndEnvironmentalProtectionType(HierarchicalType):
+ order = models.IntegerField(_("Order"), default=10)
+
+ class Meta:
+ verbose_name = _("Heritage and environmental protection type")
+ verbose_name_plural = _("Heritage and environmental protection types")
+ ordering = ("order", "label")
+
+
+post_save.connect(post_save_cache, sender=HeritageAndEnvironmentalProtectionType)
+post_delete.connect(post_save_cache, sender=HeritageAndEnvironmentalProtectionType)
+
+
class SiteType(OrderedHierarchicalType):
class Meta:
verbose_name = _("Site type")
@@ -397,6 +424,9 @@ class ArchaeologicalSite(
("current_status__label", _("Current status")),
("nature_of_site__label", _("Nature of site")),
("interpretation_level__label", _("Interpretation level")),
+ ("heritage_interests__label", _("Heritage interest")),
+ ("heritage_environmental_protections__label",
+ _("Heritage and environmental protections")),
("documents__source_type__label", _("Associated document type")),
("last_modified__FILTERyear", _("Modification (year)")),
]
@@ -435,7 +465,9 @@ class ArchaeologicalSite(
"cultural_attributions",
"towns",
"collaborators",
- "types"
+ "types",
+ "heritage_interests",
+ "heritage_environmental_protections"
]
DATED_FIELDS = BaseHistorizedItem.DATED_FIELDS + ["sinking_date"]
@@ -581,13 +613,17 @@ class ArchaeologicalSite(
RELATIVE_SESSION_NAMES = [
("operation", "operations__pk"),
]
- HISTORICAL_M2M = ["periods", "remains", "towns", "cultural_attributions", "types"]
+ HISTORICAL_M2M = ["periods", "remains", "towns", "cultural_attributions", "types",
+ "heritage_interests", "heritage_environmental_protections"]
CACHED_LABELS = [
"cached_label",
"cached_towns_label",
"cached_periods",
"cached_remains",
"cached_types",
+ "cached_current_states",
+ "cached_heritage_interests",
+ "cached_heritage_environmental_protections"
]
DOWN_MODEL_UPDATE = ["context_records"]
@@ -654,17 +690,25 @@ class ArchaeologicalSite(
Town, verbose_name=_("Towns"), related_name="sites", blank=True
)
current_status = models.ForeignKey(
+ SiteCurrentStatusType, verbose_name=_("Current status - deprecated"),
+ on_delete=models.SET_NULL, blank=True, null=True, related_name="sites_deprecated"
+ )
+ current_states = models.ManyToManyField(
SiteCurrentStatusType, verbose_name=_("Current status"),
- on_delete=models.SET_NULL, blank=True, null=True
+ blank=True
)
discovery_status = models.ForeignKey(
SiteDiscoveryStatusType, verbose_name=_("Discovery status"),
on_delete=models.SET_NULL, blank=True, null=True
)
- discoverer = models.ForeignKey(Person, verbose_name=_("Discoverer"), on_delete=models.SET_NULL,
- blank=True, null=True, related_name="site_discovered")
- nature_of_site = models.ForeignKey(NatureOfSiteType, verbose_name=_("Nature of site"),
- on_delete=models.SET_NULL, blank=True, null=True)
+ discoverer = models.ForeignKey(
+ Person, verbose_name=_("Discoverer"), on_delete=models.SET_NULL,
+ blank=True, null=True, related_name="site_discovered"
+ )
+ nature_of_site = models.ForeignKey(
+ NatureOfSiteType, verbose_name=_("Nature of site"),
+ on_delete=models.SET_NULL, blank=True, null=True
+ )
interpretation_level = models.ForeignKey(
InterpretationLevelType, verbose_name=_("Interpretation level"),
on_delete=models.SET_NULL, blank=True, null=True
@@ -685,6 +729,18 @@ class ArchaeologicalSite(
verbose_name=_("Collaborators"),
related_name="site_collaborator",
)
+ # heritage
+ heritage_interests = models.ManyToManyField(
+ HeritageInterestType, blank=True, verbose_name=_("Heritage interests")
+ )
+ protection_id = models.TextField(_("Protection ID"), blank=True, default="")
+ heritage_environmental_protections = models.ManyToManyField(
+ HeritageAndEnvironmentalProtectionType, blank=True,
+ verbose_name=_("Heritage and environmental protections")
+ )
+ details_on_protection = models.TextField(_("Details on protection"), blank=True,
+ default="")
+ protection_date = models.DateField(_("Protection date"), null=True, blank=True)
# underwater
shipwreck_name = models.TextField(_("Shipwreck name"), blank=True, default="")
oceanographic_service_localisation = models.TextField(
@@ -704,6 +760,9 @@ class ArchaeologicalSite(
QualifiedBiographicalNote, related_name="sites", verbose_name=_("Actors"),
blank=True
)
+ editors = models.ManyToManyField(
+ Author, related_name="sites", verbose_name=_("Editors"), blank=True
+ )
documents = models.ManyToManyField(
Document, related_name="sites", verbose_name=_("Documents"), blank=True
)
@@ -739,6 +798,24 @@ class ArchaeologicalSite(
default="",
help_text=_("Generated automatically - do not edit"),
)
+ cached_current_states = models.TextField(
+ _("Cached current states label"),
+ blank=True,
+ default="",
+ help_text=_("Generated automatically - do not edit"),
+ )
+ cached_heritage_interests = models.TextField(
+ _("Cached heritage interests label"),
+ blank=True,
+ default="",
+ help_text=_("Generated automatically - do not edit"),
+ )
+ cached_heritage_environmental_protections = models.TextField(
+ _("Cached heritage and environmental protections label"),
+ blank=True,
+ default="",
+ help_text=_("Generated automatically - do not edit"),
+ )
history = HistoricalRecords(bases=[HistoryModel])