From 38f7e9685df66772253a4eb1cd6d53a9d461a937 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 4 Apr 2013 18:48:14 +0200 Subject: Operation sheet: group parcels by sections - add parcels to File sheet (refs #1193) --- archaeological_files/models.py | 6 +++++- .../templates/ishtar/sheet_file.html | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'archaeological_files') 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 +# Copyright (C) 2012-2013 Étienne Loks # 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 @@ -62,6 +62,28 @@ {% if item.general_contractor %}

{{ item.general_contractor.full_label }}

{% endif %} {% endif %} + + + + + + + + {##} + + {% 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" %}
+ -- cgit v1.2.3
{%trans "Admninistrative acts"%}