summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archaeological_context_records/models.py3
-rw-r--r--archaeological_operations/models.py6
-rw-r--r--archaeological_operations/templates/ishtar/sheet_site.html7
3 files changed, 14 insertions, 2 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index d990cff09..c7b73ba54 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -609,7 +609,8 @@ class ContextRecord(
"parcel_1": "operation__parcels__parcel_number",
"parcel_2": "operation__parcels__public_domain",
"label": "label__icontains",
- "archaeological_sites": "operation__archaeological_sites__pk",
+ "archaeological_sites": "archaeological_site__pk",
+ "archaeological_sites_operations": "operation__archaeological_sites__pk",
"cached_label": "cached_label__icontains",
"datings__period__label": "datings__period__label",
"operation_id": "operation_id", # dynamic_table_documents
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index a976e427f..5a787d19e 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -789,6 +789,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 %}