diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2026-02-20 13:47:02 +0100 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2026-02-23 11:26:43 +0100 |
| commit | 7b139ec52e8107d00a164941fa8cc13cfedd5d2d (patch) | |
| tree | 91e2039884dd9990cc62b57c89db6087212c9144 | |
| parent | 3a51b7b0d31b99061541ac71ea7da48735ba8a32 (diff) | |
| download | Ishtar-7b139ec52e8107d00a164941fa8cc13cfedd5d2d.tar.bz2 Ishtar-7b139ec52e8107d00a164941fa8cc13cfedd5d2d.zip | |
✨ sheet archaeological site - tables for context record from operation or directly link (refs #6623)
| -rw-r--r-- | archaeological_context_records/models.py | 3 | ||||
| -rw-r--r-- | archaeological_operations/models.py | 6 | ||||
| -rw-r--r-- | archaeological_operations/templates/ishtar/sheet_site.html | 7 |
3 files changed, 14 insertions, 2 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 7524d86d2..d104b4351 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -668,7 +668,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 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 %} |
