diff options
-rw-r--r-- | archaeological_files/templates/ishtar/sheet_file.html | 29 | ||||
-rw-r--r-- | archaeological_operations/templates/ishtar/sheet_operation.html | 19 | ||||
-rw-r--r-- | ishtar_common/models.py | 31 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/blocks/window_field.html | 2 |
4 files changed, 65 insertions, 16 deletions
diff --git a/archaeological_files/templates/ishtar/sheet_file.html b/archaeological_files/templates/ishtar/sheet_file.html index 10ee82232..67341c07d 100644 --- a/archaeological_files/templates/ishtar/sheet_file.html +++ b/archaeological_files/templates/ishtar/sheet_file.html @@ -76,14 +76,27 @@ <h3>{% trans "Preventive archaelogical file"%}</h3> {% 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 %} -{% if item.permit_reference %}<p><label>{%trans "Permit reference:"%}</label> <span class='value'>{{ item.permit_reference }}</span></p>{% endif %} -{% if item.general_contractor.attached_to %}<p><label>{%trans "General contractor organisation:"%}</label> <span class='value'>{{ item.general_contractor.attached_to }}</span></p>{% endif %} <!-- Contractor's organisation displayed as concat of Name/Adress/postal_code/city --> -{% if item.general_contractor %}<p><label>{%trans "General contractor:"%}</label> <span class='value'>{{ item.general_contractor.full_label }}</span></p>{% endif %} - -{%else%} + +{% field "Saisine type" item.saisine_type %} + +{% field "Responsible for town planning service" item.responsible_town_planning_service.full_address %} +{% if item.town_planning_service %} + {% field "Town planning service organization" item.town_planning_service.full_address %} +{% else %} + {% field "Town planning service organization" item.responsible_town_planning_service.attached_to.full_address %} +{% endif %} + +{% field "Permit type" item.permit_type %} +{% field "Permit reference" item.reference %} + +{% field "General contractor" item.general_contractor.full_address %} +{% if item.corporation_general_contractor %} + {% field "General contractor organization" item.corporation_general_contractor.full_address %} +{% else%} + {% field "General contractor organization" item.general_contractor.attached_to.full_address %} +{% endif %} + +{% else %} <h3>{% trans "Research archaeology"%}</h3> {% if item.departments.count %}<p><label>{%trans "Departments"%}{%trans ":"%}</label> <span class='value'>{% for department in item.departments.all %}{% if forloop.counter0 %}, {% endif %}{{ department }}{% endfor %}</span></p>{% endif %} diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index e3a53e5fa..c0beac524 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -73,11 +73,24 @@ <p><label>{%trans "Associated file:"%}</label> <span class='value'><a href='#' onclick='load_window("{% url show-file item.associated_file.pk ''%}")'>{{ item.associated_file }}</a></span></p><!-- Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related file --> {% if item.associated_file.is_preventive %} {#{% if item.operator_reference_code %}<p><label>{%trans "Operator's reference code:"%}</label> <span class='value'>{{ item.operator_reference_code }}</span></p>{% endif %}#} -{% if item.associated_file.town_planning_service %}<p><label>{%trans "Town planning service:"%}</label> <span class='value'>{{ item.associated_file.town_planning_service }}</span></p>{% endif %} + +{% field "Responsible for town planning service" item.associated_file.responsible_town_planning_service.full_address %} +{% if item.associated_file.town_planning_service %} + {% field "Town planning service organization" item.associated_file.town_planning_service.full_address %} +{% else %} + {% field "Town planning service organization" item.associated_file.responsible_town_planning_service.attached_to.full_address %} +{% endif %} + {% if item.associated_file.permit_type %}<p><label>{%trans "Permit type:"%}</label> <span class='value'>{{ item.associated_file.permit_type }}</span></p>{% endif %} {% if item.associated_file.permit_reference %}<p><label>{%trans "Permit reference:"%}</label> <span class='value'>{{ item.associated_file.permit_reference }}</span></p>{% endif %} -{% if item.associated_file.general_contractor.attached_to %}<p><label>{%trans "General contractor organisation:"%}</label> <span class='value'>{{ item.associated_file.general_contractor.attached_to }}</span></p>{% endif %} <!-- Contractor's organisation displayed as concat of Name/Adress/postal_code/city --> -{% if item.associated_file.general_contractor %}<p><label>{%trans "General contractor:"%}</label> <span class='value'>{{ item.associated_file.general_contractor.full_label }}</span></p>{% endif %} + +{% field "General contractor" item.associated_file.general_contractor.full_address %} +{% if item.associated_file.corporation_general_contractor %} + {% field "General contractor organization" item.associated_file.corporation_general_contractor.full_address %} +{% else%} + {% field "General contractor organization" item.associated_file.general_contractor.attached_to.full_address %} +{% endif %} + {% endif %} {% endif %} diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 2745bf4b6..61376e079 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1069,8 +1069,18 @@ class Address(BaseHistorizedItem): class Meta: abstract = True + def simple_lbl(self): + return unicode(self) + + def full_address(self): + lbl = self.simple_lbl() + if lbl: + lbl += u"\n" + lbl += self.address_lbl() + return lbl + def address_lbl(self): - lbl = '' + lbl = u'' if self.address: lbl += self.address if self.address_complement: @@ -1085,11 +1095,11 @@ class Address(BaseHistorizedItem): " " if self.postal_code and self.town else '', self.town or '') if self.phone: - lbl += "{}{}".format(_("Tel:"), self.phone) + lbl += "{}{}".format(unicode(_("Tel:")), self.phone) if self.mobile_phone: - lbl += "{}{}".format(_("Mobile: "), self.mobile_phone) + lbl += "{}{}".format(unicode(_("Mobile: ")), self.mobile_phone) if self.email: - lbl += "{}{}".format(_("Email: "), self.email) + lbl += "{}{}".format(unicode(_("Email: ")), self.email) return lbl @@ -1880,6 +1890,12 @@ class Organization(Address, Merge, OwnPerms, ValueGetter): ugettext(u"Can delete own Organization")), ) + def simple_lbl(self): + if self.name: + return self.name + return u"{} - {}".format(self.organization_type, + self.town or "") + def __unicode__(self): if self.name: return self.name @@ -1949,6 +1965,13 @@ class Person(Address, Merge, OwnPerms, ValueGetter): ("delete_own_person", ugettext(u"Can delete own Person")), ) + def simple_lbl(self): + values = [unicode(getattr(self, attr)) for attr in ('surname', 'name') + if getattr(self, attr)] + if not values and self.raw_name: + values = [self.raw_name] + return u" ".join(values) + def __unicode__(self): values = [unicode(getattr(self, attr)) for attr in ('surname', 'name') if getattr(self, attr)] diff --git a/ishtar_common/templates/ishtar/blocks/window_field.html b/ishtar_common/templates/ishtar/blocks/window_field.html index bca32225c..14cf1c21e 100644 --- a/ishtar_common/templates/ishtar/blocks/window_field.html +++ b/ishtar_common/templates/ishtar/blocks/window_field.html @@ -1,3 +1,3 @@ {% load i18n %} {% if data %}<p><label>{% trans caption %}{% trans ":"%}</label> -<span class='value'>{{pre_data|safe}}{{data}}{{post_data|safe}}</span></p>{% endif%} +<span class='value'>{{pre_data|safe}}{{data|linebreaksbr}}{{post_data|safe}}</span></p>{% endif%} |