From 840b6f72e9624c17f40dc4efa3aa83d1017dbee6 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 19 Jan 2018 19:13:07 +0100 Subject: Improve sheet context record --- .../templates/ishtar/sheet_contextrecord.html | 157 ++++++++++++--------- archaeological_operations/models.py | 8 +- .../templates/ishtar/sheet_operation.html | 18 +-- 3 files changed, 104 insertions(+), 79 deletions(-) diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html index 93a9b67d2..4fa98c6a9 100644 --- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html @@ -1,7 +1,7 @@ {% extends "ishtar/sheet.html" %} {% load i18n window_field window_header window_tables window_field %} -{% block head_title %}{% trans "Context Record:" %}{{item.full_label}}{% endblock %} +{% block head_title %}{% trans "Context Record" %} - {{item.full_label}}{% endblock %} {% block toolbar %} {% window_nav item window_id 'show-contextrecord' 'record_modify' 'show-historized-contextrecord' 'revert-contextrecord' previous next 1 %} @@ -9,65 +9,73 @@ {% block content %} -{% if item.image %} - -{% endif%} - -

{{ item.parcel.short_label }}

-

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

-{% include "ishtar/blocks/sheet_external_id.html" %} - - -{% field "Comment on datings" item.datings_comment "
" "
" %} + {% field_flex "Type" item.unit %} + {% field_flex "Excavation technic" item.excavation_technic %} + {% field_flex_multiple "Chronology" item.datings %} + {% field_flex "Town" item.parcel.town %} + {% field_flex_multiple "Documentation" item.documentations %} + {% field_flex "Opening date" item.opening_date %} + {% field_flex "Closing date" item.closing_date %} + {% field_flex_full "Comment on datings" item.datings_comment "
" "
" %} + {% include "ishtar/blocks/sheet_json.html" %} {% if item.diameter or item.depth_of_appearance or item.documentations.count or item.description or item.lenght or item.width or item.depth or item.thickness or item.comment %}

{% trans "Description"%}

-{% field "Description" item.description "
" "
" %} -{% field "Comment" item.comment "
" "
" %} - +
+ {% field_flex_full "Description" item.description "
" "
" %} + {% field_flex_full "Comment" item.comment "
" "
" %} + {% field_flex "Length (m)" item.lenght %} + {% field_flex "Width (m)" item.width %} + {% field_flex "Diameter (m)" item.diameter %} + {% field_flex "Depth (m)" item.depth %} + {% field_flex "Thickness (m)" item.thickness %} + {% field_flex "Depth of appearance (m)" item.depth_of_appearance %} +
{% endif %} {% if item.activity or item.identification or item.interpretation %}

{% trans "Interpretation"%}

- - -{% field "Filling" item.filling "
" "
" %} -{% field "Interpretation" item.interpretation "
" "
" %} +
+ {% field_flex_multiple "Documentation" item.documentations %} + {% field_flex "Activity" item.activity %} + {% field_flex "Identification" item.identification %} + {% field_flex_full "Filling" item.filling "
" "
" %} + {% field_flex_full "Interpretation" item.interpretation "
" "
" %} +
{% endif %} {% if item.taq or item.taq_estimated or item.tpq or item.tpq_estimated %}

{% trans "Datations"%}

- +
+ {% field_flex "TAQ" item.taq %} + {% field_flex "Estimated TAQ" item.taq_estimated %} + {% field_flex "TPQ" item.tpq %} + {% field_flex "Estimated TPQ" item.tpq_estimated %} +
{% endif %} {% trans "Context record relations" as cr_rels %} @@ -79,31 +87,48 @@ {% if item.operation %}

{% trans "Operation summary"%}

{% if not item.operation.code_patriarche %} -

+ {% endif %} - -{% field "Comment" item.operation.comment "
" "
" %} + {% field_flex num_ref_label item.operation.operation_code %} + {% field_flex "Patriarche OA code" item.operation.code_patriarche %} + {% field_flex_detail "Head scientist" item.operation.scientist %} + +
+
{% trans "State" %}
+
{% if item.operation.is_active %}{% trans "Active file" %}{% else %}{%trans "Closed operation" %}{% endif %}
+
+ + {% if not item.operation.is_active %} +
+
{%trans "Closing date"%}
+
+ {{ item.operation.closing.date }} {%trans "by" %} {{ item.operation.closing.user }} +
+
+ {% endif %} + {% field_flex "Type" item.operation.operation_type %} + {% field_flex_multiple "Remains" item.operation.remains %} + {% field_flex_multiple "Periods" item.operation.periods %} + {% field_flex_full "Comment" item.operation.comment "
" "
" %} +

{% trans "Localisation"%}

-

{{ item.operation.towns.all|join:", " }}

-

-{{ item.operation }}

-{% else %}

-{% endif %} +
+ {% field_flex_multiple "Towns" item.operation.towns %} + {% field_flex_detail "Operation" item.operation %} +
+ +{% else %} + +{% endif %} {% trans "Document from this context record" as cr_docs %} {% if item.source.count %} {% dynamic_table_document cr_docs 'context_records_docs' 'context_record' item.pk '' output %} diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 5c3b91e9f..58fa8b8c6 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -645,7 +645,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, q = self.context_record.values( 'unit', 'unit__label').distinct().order_by('label') for res in q.all(): - nbs.append((unicode(res['unit__label']), + nbs.append((unicode(res['unit__label'] or "-"), self.context_record.filter(unit=res['unit']).count())) return list(set(nbs)) @@ -659,7 +659,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, 'datings__period', 'datings__period__label').distinct().order_by( 'datings__period__order') for res in q.all(): - nbs.append((unicode(res['datings__period__label']), + nbs.append((unicode(res['datings__period__label'] or "-"), self.context_record.filter( datings__period=res['datings__period']).count())) return nbs @@ -690,7 +690,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, 'material_types__label') for res in q.all(): nbs.append( - (unicode(res['material_types__label']), + (unicode(res['material_types__label'] or "-"), Find.objects.filter( base_finds__context_record__operation=self, upstream_treatment_id__isnull=True, @@ -733,7 +733,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, 'datings__period__order') for res in q.all(): nbs.append( - (unicode(res['datings__period__label']), + (unicode(res['datings__period__label'] or "-"), Find.objects.filter( base_finds__context_record__operation=self, upstream_treatment_id__isnull=True, diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index 1f3e9e157..565bccbb2 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -229,20 +229,20 @@
{% if item.nb_context_records_by_type %}
- +
{% for label, nb in item.nb_context_records_by_type %} - + {% endfor %}
{% trans "Type" %}{% trans "Number" %}
{{label}}{{nb}}
{{label|default:"-"}}{{nb}}
{% endif %} {% if item.nb_context_records_by_periods %}
- +
{% for label, nb in item.nb_context_records_by_periods %} - + {% endfor %}
{% trans "Period" %}{% trans "Number" %}
{{label}}{{nb}}
{{label|default:"-"}}{{nb}}
@@ -256,17 +256,17 @@
{% if item.nb_finds_by_material_type %}
- +
{% for label, nb in item.nb_finds_by_material_type %} - + {% endfor %}
{% trans "Material type" %}{% trans "Number" %}
{{label}}{{nb}}
{{label|default:"-"}}{{nb}}
{% endif %} {% if item.nb_finds_by_types %}
- +
{% for label, nb in item.nb_finds_by_types %} @@ -276,10 +276,10 @@ {% endif %} {% if item.nb_finds_by_periods %}
-
{% trans "Object type" %}{% trans "Number" %}
{{label}}{{nb}}
+
{% for label, nb in item.nb_finds_by_periods %} - + {% endfor %}
{% trans "Period" %}{% trans "Number" %}
{{label}}{{nb}}
{{label|default:"-"}}{{nb}}
-- cgit v1.2.3