From 2266775ccf26574da6cdd5fc5d514bb999a3f912 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 13 Mar 2013 11:51:50 +0100 Subject: Operations: better display of missing operation_code --- archaeological_operations/models.py | 3 ++- ishtar_common/templates/sheet_operation.html | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index a0b751802..399b536e2 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -161,7 +161,8 @@ class Operation(BaseHistorizedItem, OwnPerms): year_index_lbl = _(u"Operation code") @property def year_index(self): - lbl = unicode(self.operation_code) + if not self.operation_code: + return "" lbl = u"%d-%s%s" % (self.year, (3-len(lbl))*"0", lbl) return lbl diff --git a/ishtar_common/templates/sheet_operation.html b/ishtar_common/templates/sheet_operation.html index edceca989..7b161f641 100644 --- a/ishtar_common/templates/sheet_operation.html +++ b/ishtar_common/templates/sheet_operation.html @@ -4,7 +4,7 @@
{%trans "Export as:"%} {%trans "OpenOffice.org file"%}, {%trans "PDF file"%}

{% trans "General"%}

{{ item.year }}

-

{{ item.operation_code }}

+{% if item.operation.operation_code %}

{{ item.operation_code }}

{% endif %} {% if item.code_patriarche %}

{{ item.code_patriarche }}

{%else%}

{%trans "Patriarche OA code not yet recorded!"%}

{%endif%} -- cgit v1.2.3