summaryrefslogtreecommitdiff
path: root/archaeological_finds
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-05-05 18:45:33 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:21:00 +0100
commit0f5d1297503a97e865ce211b2a0c801b21cfd613 (patch)
treebc849de6718bea64126c2d25fc36973a0599fb1c /archaeological_finds
parent810d6074789e3e6b11854f676314972a6952b486 (diff)
downloadIshtar-0f5d1297503a97e865ce211b2a0c801b21cfd613.tar.bz2
Ishtar-0f5d1297503a97e865ce211b2a0c801b21cfd613.zip
Geodata: display geodata list on sheet
Diffstat (limited to 'archaeological_finds')
-rw-r--r--archaeological_finds/models_finds.py7
-rw-r--r--archaeological_finds/templates/ishtar/sheet_find.html29
2 files changed, 34 insertions, 2 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index ce9a5e4af..7d6d43d6c 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -66,7 +66,7 @@ from ishtar_common.models import (
SearchVectorConfig,
DocumentItem,
)
-from ishtar_common.models_common import HistoricalRecords, SerializeItem
+from ishtar_common.models_common import HistoricalRecords, SerializeItem, GeoVectorData
from ishtar_common.utils import PRIVATE_FIELDS
@@ -2052,6 +2052,11 @@ class Find(
def natural_key(self):
return (self.uuid,)
+ def geoitem(self):
+ return GeoVectorData.objects.filter(
+ related_items_archaeological_finds_basefind__find__pk=self.pk
+ )
+
@property
def short_class_name(self):
return _("FIND")
diff --git a/archaeological_finds/templates/ishtar/sheet_find.html b/archaeological_finds/templates/ishtar/sheet_find.html
index 5b6c38112..af10a8711 100644
--- a/archaeological_finds/templates/ishtar/sheet_find.html
+++ b/archaeological_finds/templates/ishtar/sheet_find.html
@@ -18,6 +18,7 @@
{# trick to set to null non existing variable #}
{% with permission_view_document=permission_view_document %}
{% with permission_view_own_document=permission_view_own_document %}
+{% with permission_change_geo=permission_change_own_geovectordata|or_:permission_change_geovectordata %}
{% with non_modif_treatments_count=item.non_modif_treatments_count %}
{% with associated_treatment_files_count=item.associated_treatment_files_count %}
@@ -26,6 +27,7 @@
{% with display_warehouse_treatments=item.container|or_:item.container_ref|or_:item.upstream_treatment|or_:item.downstream_treatment|or_:non_modif_treatments_count|or_:associated_treatment_files_count %}
{% with can_view_documents=permission_view_own_document|or_:permission_view_document %}
{% with display_documents=can_view_documents|and_:item.documents_count %}
+{% with display_geo=item.geodata.count %}
{% if output != "ODT" and output != "PDF"%}
<ul class="nav nav-tabs" id="{{window_id}}-tabs" role="tablist">
@@ -70,6 +72,15 @@
</a>
</li>
{% endif %}
+ {% if not is_external and display_geo %}
+ <li class="nav-item">
+ <a class="nav-link" id="{{window_id}}-geodata-tab"
+ data-toggle="tab" href="#{{window_id}}-geodata" role="tab"
+ aria-controls="{{window_id}}-geodata" aria-selected="false">
+ {% trans "Geographic data" %}
+ </a>
+ </li>
+ {% endif %}
{% if item.data %}
<li class="nav-item">
<a class="nav-link" id="{{window_id}}-json-tab"
@@ -520,6 +531,22 @@
{% endif %}
</div>
{% endif %}
+
+ {% if not is_external and display_geo %}
+ <div class="tab-pane fade" id="{{window_id}}-geodata"
+ role="tabpanel" aria-labelledby="{{window_id}}-geodata-tab">
+
+ {% for base_find in item.base_finds.all %}
+ {% with geo_item=base_find %}
+ <h3>{% if base_find.complete_identifier %}{{ base_find.complete_identifier }}{% else %}{{base_find.short_id}}{% endif %}</h3>
+ {% with current_geolabel=base_find %}
+ {% include "ishtar/blocks/sheet_geographic.html" %}
+ {% endwith %}
+ {% endfor %}
+
+ </div>
+ {% endif %}
+
{% if item.data and item.data|length > 0 %}
<div class="tab-pane fade" id="{{window_id}}-json"
role="tabpanel" aria-labelledby="{{window_id}}-json-tab">
@@ -528,7 +555,7 @@
{% endif %}
</div>
-{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}
+{% endwith %} {% endwith %} {% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}
{% endblock %}