diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-01-19 19:13:07 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-01-19 19:13:07 +0100 |
commit | 840b6f72e9624c17f40dc4efa3aa83d1017dbee6 (patch) | |
tree | a10ff1a0d8c0562099a7c9a327318f0bcb0d3d21 /archaeological_operations | |
parent | 819ff20e535d670bf4d7946284049d92cc261ede (diff) | |
download | Ishtar-840b6f72e9624c17f40dc4efa3aa83d1017dbee6.tar.bz2 Ishtar-840b6f72e9624c17f40dc4efa3aa83d1017dbee6.zip |
Improve sheet context record
Diffstat (limited to 'archaeological_operations')
-rw-r--r-- | archaeological_operations/models.py | 8 | ||||
-rw-r--r-- | archaeological_operations/templates/ishtar/sheet_operation.html | 18 |
2 files changed, 13 insertions, 13 deletions
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 @@ <div class='row'> {% if item.nb_context_records_by_type %} <div class="col-12 col-md-6 col-lg-4"> - <table> + <table class="table"> <tr><th>{% trans "Type" %}</th><th>{% trans "Number" %}</th></tr> {% for label, nb in item.nb_context_records_by_type %} - <tr><td>{{label}}</td><td>{{nb}}</td></tr> + <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr> {% endfor %} </table> </div> {% endif %} {% if item.nb_context_records_by_periods %} <div class="col-12 col-md-6 col-lg-4"> - <table> + <table class="table"> <tr><th>{% trans "Period" %}</th><th>{% trans "Number" %}</th></tr> {% for label, nb in item.nb_context_records_by_periods %} - <tr><td>{{label}}</td><td>{{nb}}</td></tr> + <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr> {% endfor %} </table> </div> @@ -256,17 +256,17 @@ <div class='row'> {% if item.nb_finds_by_material_type %} <div class="col-12 col-md-6 col-lg-4"> - <table> + <table class="table"> <tr><th>{% trans "Material type" %}</th><th>{% trans "Number" %}</th></tr> {% for label, nb in item.nb_finds_by_material_type %} - <tr><td>{{label}}</td><td>{{nb}}</td></tr> + <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr> {% endfor %} </table> </div> {% endif %} {% if item.nb_finds_by_types %} <div class="col-12 col-md-6 col-lg-4"> - <table> + <table class="table"> <tr><th>{% trans "Object type" %}</th><th>{% trans "Number" %}</th></tr> {% for label, nb in item.nb_finds_by_types %} <tr><td>{{label}}</td><td>{{nb}}</td></tr> @@ -276,10 +276,10 @@ {% endif %} {% if item.nb_finds_by_periods %} <div class="col-12 col-md-6 col-lg-4"> - <table> + <table class="table"> <tr><th>{% trans "Period" %}</th><th>{% trans "Number" %}</th></tr> {% for label, nb in item.nb_finds_by_periods %} - <tr><td>{{label}}</td><td>{{nb}}</td></tr> + <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr> {% endfor %} </table> </div> |