From 7b139ec52e8107d00a164941fa8cc13cfedd5d2d Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 20 Feb 2026 13:47:02 +0100 Subject: ✨ sheet archaeological site - tables for context record from operation or directly link (refs #6623) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archaeological_operations/models.py | 6 ++++++ archaeological_operations/templates/ishtar/sheet_site.html | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'archaeological_operations') diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index f0fa9c325..8401501b3 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -795,6 +795,12 @@ class ArchaeologicalSite( base_finds__context_record__archaeological_site__pk=self.pk ) + @property + def operations_has_cr(self): + q = Operation.objects.filter( + archaeological_sites__id=self.pk, context_record__isnull=False) + return q.exists() + def get_extra_actions(self, request, window_id=None): """ For sheet template diff --git a/archaeological_operations/templates/ishtar/sheet_site.html b/archaeological_operations/templates/ishtar/sheet_site.html index 8b7a0f152..0956478b4 100644 --- a/archaeological_operations/templates/ishtar/sheet_site.html +++ b/archaeological_operations/templates/ishtar/sheet_site.html @@ -101,10 +101,15 @@ {% endif %} {% trans "Context records" as cr_label %} -{% if item.context_records.count %} +{% if item.context_records.count and not item.context_record_not_available %} {% dynamic_table_document cr_label 'context_records' 'archaeological_sites' item.pk '' output %} {% endif %} +{% trans "Context records from operations" as cr_label %} +{% if item.operations_has_cr and not item.context_record_not_available %} +{% dynamic_table_document cr_label 'context_records' 'archaeological_sites_operations' item.pk '' output %} +{% endif %} + {% if item.finds.count and not item.finds_not_available %} {% trans "Finds" as finds %} {% dynamic_table_document finds 'finds' 'base_finds__context_record__archaeological_site' item.pk '' output %} -- cgit v1.2.3