From 0cc64347e47a0c3117bb4514e6b966f651f552f4 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 21 Jul 2014 12:11:57 +0200 Subject: Improve layout of parcels --- .../templates/ishtar/sheet_file.html | 27 ++++------------------ archaeological_operations/models.py | 1 + .../ishtar/blocks/window_tables/parcels.html | 22 ++++++++++++++++++ .../templates/ishtar/sheet_operation.html | 24 +++---------------- 4 files changed, 30 insertions(+), 44 deletions(-) create mode 100644 archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html diff --git a/archaeological_files/templates/ishtar/sheet_file.html b/archaeological_files/templates/ishtar/sheet_file.html index cec748dfc..11a90df9e 100644 --- a/archaeological_files/templates/ishtar/sheet_file.html +++ b/archaeological_files/templates/ishtar/sheet_file.html @@ -41,7 +41,7 @@

{{ item.in_charge.full_label }}

{% if item.is_active %}{%trans "Active file"%}

{% else %}{%trans "Closed file"%}

-

{{ item.closing.date }} {%trans "by" %} {{ item.closing.user }}

+{% if item.closing %}

{{ item.closing.date }} {%trans "by" %} {{ item.closing.user.full_label }}

{% endif %} {% endif %}

{{ item.file_type }}

@@ -62,7 +62,7 @@ {% if item.is_preventive %}

{% trans "Preventive archaelogical file"%}

-

{{ item.total_developed_surface }} m2 ({{ item.total_developed_surface_ha }} ha)

+{% if item.total_developed_surface %}

{{ item.total_developed_surface }} m2 ({{ item.total_developed_surface_ha }} ha)

{% endif %}

{{ item.saisine_type }}

{% if item.town_planning_service %}

{{ item.town_planning_service }}

{% endif %} {% if item.permit_type %}

{{ item.permit_type }}

{% endif %} @@ -86,27 +86,8 @@ {% endif %} - - - - - - - - {##} - - {% for parcel in item.grouped_parcels %} - - - - - - {##} - - {% empty %} - - {% endfor %} -
{%trans "Associated parcels"%}
{% trans "Town" %}{% trans "Year" %}{% trans "Section" %}{% trans "Parcels" %}{% trans "Owner" %}
{{parcel.town}}{{parcel.year}}{{parcel.section}}{{parcel.parcel_numbers|join:", "}}{{operation.parcel.owner}}
{% trans "No parcel associated to this operation" %}
+{% trans "Associated parcels" as parcels_label %} +{% include "ishtar/blocks/window_tables/parcels.html" %} {% trans "Administrativ acts" as administrativeacts_label %} {% table_administrativact administrativeacts_label item.administrative_act.all %} diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 7a2748032..020e66bfb 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -631,6 +631,7 @@ class Parcel(LightHistorizedItem): class Meta: verbose_name = _(u"Parcel") verbose_name_plural = _(u"Parcels") + ordering = ('year', 'section', 'parcel_number') @property def short_label(self): diff --git a/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html b/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html new file mode 100644 index 000000000..06a1fa7b1 --- /dev/null +++ b/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html @@ -0,0 +1,22 @@ +{% load i18n %} + + + + + + + + {##} + + {% for parcel in item.grouped_parcels %} + + + + + + {##} + + {% empty %} + + {% endfor %} +
{{ parcels_label }}
{% trans "Town" %}{% trans "Year" %}{% trans "Section" %}{% trans "Parcels" %}{% trans "Owner" %}
{{parcel.town}}{% if parcel.year %}{{parcel.year}}{% endif %}{{parcel.section}}{{parcel.parcel_numbers|join:", "}}{{operation.parcel.owner}}
{% trans "No parcel" %}
diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index 098bbd72b..0b5e58d56 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -80,27 +80,9 @@

{{ item.lambert_y }}

{{ item.altitude }}

{% endcomment %} - - - - - - - - {##} - - {% for parcel in item.grouped_parcels %} - - - - - - {##} - - {% empty %} - - {% endfor %} -
{%trans "Associated parcels"%}
{% trans "Commune" %}{% trans "Year" %}{% trans "Section" %}{% trans "Parcels" %}{% trans "Owner" %}
{{parcel.town}}{{parcel.year}}{{parcel.section}}{{parcel.parcel_numbers|join:", "}}{{operation.parcel.owner}}
{% trans "No parcel associated to this operation" %}
+ +{% trans "Associated parcels" as parcels_label %} +{% include "ishtar/blocks/window_tables/parcels.html" %} {% trans "Administrativ acts" as administrativeacts_label %} {% table_administrativact administrativeacts_label item.administrative_act.all %} -- cgit v1.2.3