From 570e5aad8f16c0c41286ba139887519a7fd7ba92 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 7 May 2021 10:39:18 +0200 Subject: Sheets: display parcel address --- .../templates/ishtar/sheet_contextrecord.html | 2 +- archaeological_operations/models.py | 5 +++-- .../templates/ishtar/blocks/window_tables/parcels.html | 8 +++++--- archaeological_operations/templates/ishtar/sheet_operation.html | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html index a8be74542..62454d6f6 100644 --- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html @@ -111,7 +111,7 @@ {% if item.complete_identifier %}

{{ item.complete_identifier }}

{% endif %} -

{{ item.parcel.short_label }}

+

{{ item.parcel.short_label }}

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

{% include "ishtar/blocks/sheet_external_id.html" %} diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 7bc50d0b0..802751963 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -2773,14 +2773,15 @@ class Parcel(LightHistorizedItem): class Meta: verbose_name = _("Parcel") verbose_name_plural = _("Parcels") - ordering = ("year", "section", "parcel_number") + ordering = ("town", "year", "section", "parcel_number") indexes = [ GinIndex(fields=["data"]), ] @property def short_label(self): - items = [str(item) for item in [self.section, self.parcel_number] if item] + items = [str(item) for item in [self.section, self.parcel_number, self.address] + if item] if self.public_domain: items.append(str(_("Public domain"))) return settings.JOINT.join(items) diff --git a/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html b/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html index 6e7929ab5..c748b1530 100644 --- a/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html +++ b/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html @@ -6,17 +6,19 @@ {% trans "Town" %} {% trans "Year" %} {% trans "Section" %} - {% trans "Parcels" %} + {% trans "Parcel" %} + {% trans "Address" %} {#{% trans "Owner" %}#} - {% for parcel in item.grouped_parcels %} + {% for parcel in item.parcels.all %} {{parcel.town}} {{parcel.year|default_if_none:"-"}} {{parcel.section|default_if_none:"-"}} - {{parcel.parcel_numbers|join:", "}} + {{parcel.parcel_number|default_if_none:"-"}} + {{parcel.address|default_if_none:"-"}} {#{{operation.parcel.owner}}#} {% empty %} diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index 2afdb6c4c..88fa2356a 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -302,7 +302,7 @@ {% dynamic_table_document archaeologicalsites_label 'sites' 'operations' item.pk '' output %} {% endif %} - {% if item.grouped_parcels %} + {% if item.parcels.count %} {% trans "Associated parcels" as parcels_label %} {% include "ishtar/blocks/window_tables/parcels.html" %} {% endif %} -- cgit v1.2.3