summaryrefslogtreecommitdiff
path: root/archaeological_files
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2013-04-04 18:48:14 +0200
committerÉtienne Loks <etienne.loks@peacefrogs.net>2013-04-04 18:48:14 +0200
commit38f7e9685df66772253a4eb1cd6d53a9d461a937 (patch)
tree6a132db71c7a30abf475fdeaf7a8f0afc2bb2eae /archaeological_files
parent6c225450c36c0fb58df61dd641f25fa78db2c7a5 (diff)
downloadIshtar-38f7e9685df66772253a4eb1cd6d53a9d461a937.tar.bz2
Ishtar-38f7e9685df66772253a4eb1cd6d53a9d461a937.zip
Operation sheet: group parcels by sections - add parcels to File sheet (refs #1193)
Diffstat (limited to 'archaeological_files')
-rw-r--r--archaeological_files/models.py6
-rw-r--r--archaeological_files/templates/ishtar/sheet_file.html22
2 files changed, 27 insertions, 1 deletions
diff --git a/archaeological_files/models.py b/archaeological_files/models.py
index a91f6ed69..1e2c36ed0 100644
--- a/archaeological_files/models.py
+++ b/archaeological_files/models.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (C) 2012 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+# Copyright (C) 2012-2013 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -133,6 +133,10 @@ class File(BaseHistorizedItem, OwnPerms):
for k in ['internal_reference',] if getattr(self, k)]
return settings.JOINT.join(items)
+ def grouped_parcels(self):
+ from archaeological_operations.models import Parcel
+ return Parcel.grouped_parcels(list(self.parcels.all()))
+
@classmethod
def get_query_owns(cls, user):
return Q(history_modifier=user) & Q(end_date__isnull=True)
diff --git a/archaeological_files/templates/ishtar/sheet_file.html b/archaeological_files/templates/ishtar/sheet_file.html
index 1b58aa332..bdf0bd4ff 100644
--- a/archaeological_files/templates/ishtar/sheet_file.html
+++ b/archaeological_files/templates/ishtar/sheet_file.html
@@ -63,6 +63,28 @@
{% endif %}
<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>
+
+<table>
<caption>{%trans "Admninistrative acts"%}</caption>
<tr>
<th>{% trans "Year" %}</th>