From 6bfcffe23290c79c7d72e0aec45bd9ed86d52c14 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 6 Mar 2023 17:14:22 +0100 Subject: Sheet Treatment file: add associated image and document list (refs #4275) --- archaeological_finds/models_treatments.py | 3 ++- .../templates/ishtar/sheet_treatmentfile.html | 25 +++++++++++++--------- 2 files changed, 17 insertions(+), 11 deletions(-) (limited to 'archaeological_finds') diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index 2ee23c1c6..5e355cfcd 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -46,6 +46,7 @@ from ishtar_common.models import ( ShortMenuItem, DashboardFormItem, document_attached_changed, + MainItem, HistoryModel, SearchAltName, SearchVectorConfig, @@ -1017,7 +1018,7 @@ class TreatmentFile( CompleteIdentifierItem, OwnPerms, ValueGetter, - ShortMenuItem, + MainItem, ): SLUG = "treatmentfile" APP = "archaeological-finds" diff --git a/archaeological_finds/templates/ishtar/sheet_treatmentfile.html b/archaeological_finds/templates/ishtar/sheet_treatmentfile.html index 0c036978f..eacf853ca 100644 --- a/archaeological_finds/templates/ishtar/sheet_treatmentfile.html +++ b/archaeological_finds/templates/ishtar/sheet_treatmentfile.html @@ -1,5 +1,5 @@ {% extends "ishtar/sheet.html" %} -{% load i18n window_field from_dict link_to_window window_tables window_ope_tables window_header humanize %} +{% load i18n ishtar_helpers window_field from_dict link_to_window window_tables window_ope_tables window_header humanize %} {% block head_title %}{% trans "Treatment request" %} - {{ item.name|default:"" }}{% endblock %} @@ -8,10 +8,13 @@ {% endblock %} {% block content %} +{% with perm_documents=permission_view_own_document|or_:permission_view_document %} +{% with has_documents=item|safe_or:"documents.count|documents_list" %} +{% with display_documents=perm_documents|and_:has_documents %} -
-
-
+
+
+ {% include "ishtar/blocks/window_image.html" %}

{{ item.name|default:"" }}

@@ -28,10 +31,12 @@
-
+{% with has_image=item.images.count %} +{% if not has_image %}
- +{% endif %}
+ {% endwith %} {% field_flex "Type" item.type %} {% field_flex_detail "Responsible" item.in_charge %} {% field_flex_detail "Associated basket" item.associated_basket %} @@ -41,6 +46,7 @@ {% field_flex_full "Comment" item.comment "
" "
" %} {% include "ishtar/blocks/sheet_json.html" %}
+
{% if item.exhibition_name or item.exhibition_start_date or item.exhibition_end_date %}

{% trans "Exhibition" %}

@@ -72,16 +78,15 @@ {% dynamic_table_document treatments 'treatments' 'file' item.pk '' output '' 'treatment' %} {% endif %} -{% comment %} -{% if item.source.count %} +{% if display_documents %} {% trans "Associated documents" as associated_docs %} -{% dynamic_table_document associated_docs 'treatmentfiles_docs' 'treatment_file' item.pk '' output %} +{% dynamic_table_document associated_docs 'documents' 'treatment_files' item.pk '' output %} {% endif %} -{% endcomment %} {% if item.administrative_act.count %} {% trans "Administrative acts" as admact_lbl %} {% table_administrativact admact_lbl item.administrative_act.all %} {% endif %} +{% endwith %}{% endwith %}{% endwith %} {% endblock %} -- cgit v1.2.3