summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2014-07-21 12:11:57 +0200
committerÉtienne Loks <etienne.loks@proxience.com>2014-07-21 12:11:57 +0200
commita9a1a82a5cc32ea8e5b7a8051de5ff4cd0c6fdc7 (patch)
tree73d8ae28de7795a9df8e7b6d1c99cc2d953ef306
parentc15a0ab8fa195ea8896d0c91ec8f75bf65805cdf (diff)
downloadIshtar-a9a1a82a5cc32ea8e5b7a8051de5ff4cd0c6fdc7.tar.bz2
Ishtar-a9a1a82a5cc32ea8e5b7a8051de5ff4cd0c6fdc7.zip
Improve layout of parcels
-rw-r--r--archaeological_files/templates/ishtar/sheet_file.html27
-rw-r--r--archaeological_operations/models.py1
-rw-r--r--archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html22
-rw-r--r--archaeological_operations/templates/ishtar/sheet_operation.html24
4 files changed, 30 insertions, 44 deletions
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 @@
<p><label>{%trans "In charge:"%}</label> <span class='value'>{{ item.in_charge.full_label }}</span></p>
<p><label>{%trans "State:"%}</label> <span class='value'>{% if item.is_active %}{%trans "Active file"%}</span></p>
{% else %}{%trans "Closed file"%}</span></p>
-<p><label>{%trans "Closing date:"%}</label> <span class='value'>{{ item.closing.date }} <strong>{%trans "by" %}</strong> {{ item.closing.user }}</span></p>
+{% if item.closing %}<p><label>{%trans "Closing date:"%}</label> <span class='value'>{{ item.closing.date }} <strong>{%trans "by" %}</strong> {{ item.closing.user.full_label }}</span></p>{% endif %}
{% endif %}
<p><label>{%trans "Type:"%}</label> <span class='value'>{{ item.file_type }}</span></p>
@@ -62,7 +62,7 @@
{% if item.is_preventive %}
<h3>{% trans "Preventive archaelogical file"%}</h3>
-<p><label>{%trans "Developed surface:"%}</label> <span class='value'>{{ item.total_developed_surface }} m<sup>2</sup> ({{ item.total_developed_surface_ha }} ha)</span></p>
+{% if item.total_developed_surface %}<p><label>{%trans "Developed surface:"%}</label> <span class='value'>{{ item.total_developed_surface }} m<sup>2</sup> ({{ item.total_developed_surface_ha }} ha)</span></p>{% endif %}
<p><label>{%trans "Saisine type:"%}</label> <span class='value'>{{ item.saisine_type }}</span></p>
{% if item.town_planning_service %}<p><label>{%trans "Town planning service:"%}</label> <span class='value'>{{ item.town_planning_service }}</span></p>{% endif %}
{% if item.permit_type %}<p><label>{%trans "Permit type:"%}</label> <span class='value'>{{ item.permit_type }}</span></p>{% endif %}
@@ -86,27 +86,8 @@
{% endif %}
-<table>
- <caption>{%trans "Associated parcels"%}</caption>
- <tr>
- <th>{% trans "Town" %}</th>
- <th>{% trans "Year" %}</th>
- <th>{% trans "Section" %}</th>
- <th>{% trans "Parcels" %}</th>
- {#<th>{% trans "Owner" %}</th>#}
- </tr>
- {% for parcel in item.grouped_parcels %}
- <tr>
- <td class='string'>{{parcel.town}}</td>
- <td>{{parcel.year}}</td>
- <td>{{parcel.section}}</td>
- <td>{{parcel.parcel_numbers|join:", "}}</td>
- {#<td class='string'>{{operation.parcel.owner}}</td>#}
- </tr>
- {% empty %}
- <tr><td colspan="4" class='no_items'>{% trans "No parcel associated to this operation" %}</td></tr>
- {% endfor %}
-</table>
+{% 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 %}
+<table>
+ <caption>{{ parcels_label }}</caption>
+ <tr>
+ <th>{% trans "Town" %}</th>
+ <th>{% trans "Year" %}</th>
+ <th>{% trans "Section" %}</th>
+ <th>{% trans "Parcels" %}</th>
+ {#<th>{% trans "Owner" %}</th>#}
+ </tr>
+ {% for parcel in item.grouped_parcels %}
+ <tr>
+ <td class='string'>{{parcel.town}}</td>
+ <td>{% if parcel.year %}{{parcel.year}}{% endif %}</td>
+ <td>{{parcel.section}}</td>
+ <td>{{parcel.parcel_numbers|join:", "}}</td>
+ {#<td class='string'>{{operation.parcel.owner}}</td>#}
+ </tr>
+ {% empty %}
+ <tr><td colspan="4" class='no_items'>{% trans "No parcel" %}</td></tr>
+ {% endfor %}
+</table>
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 @@
<p><label>{%trans "Lambert Y:"%}</label> <span class='value'>{{ item.lambert_y }}</span></p>
<p><label>{%trans "Altitude (m NGF):"%}</label> <span class='value'>{{ item.altitude }}</span></p>
{% endcomment %}
-<table>
- <caption>{%trans "Associated parcels"%}</caption>
- <tr>
- <th>{% trans "Commune" %}</th>
- <th>{% trans "Year" %}</th>
- <th>{% trans "Section" %}</th>
- <th>{% trans "Parcels" %}</th>
- {#<th>{% trans "Owner" %}</th>#}
- </tr>
- {% for parcel in item.grouped_parcels %}
- <tr>
- <td class='string'>{{parcel.town}}</td>
- <td>{{parcel.year}}</td>
- <td>{{parcel.section}}</td>
- <td>{{parcel.parcel_numbers|join:", "}}</td>
- {#<td class='string'>{{operation.parcel.owner}}</td>#}
- </tr>
- {% empty %}
- <tr><td colspan="4" class='no_items'>{% trans "No parcel associated to this operation" %}</td></tr>
- {% endfor %}
-</table>
+
+{% 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 %}