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 --- archaeological_operations/models.py | 8 ++++---- .../templates/ishtar/sheet_operation.html | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'archaeological_operations') 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