summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2013-03-13 11:51:50 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2013-03-13 11:51:50 +0100
commit2266775ccf26574da6cdd5fc5d514bb999a3f912 (patch)
tree627361e11d145b7477cd64557a58032e5f6df478
parent8a21118a4ab368f812ba1abc485e2662cc365ea6 (diff)
downloadIshtar-2266775ccf26574da6cdd5fc5d514bb999a3f912.tar.bz2
Ishtar-2266775ccf26574da6cdd5fc5d514bb999a3f912.zip
Operations: better display of missing operation_code
-rw-r--r--archaeological_operations/models.py3
-rw-r--r--ishtar_common/templates/sheet_operation.html2
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 @@
<div class='tool'>{%trans "Export as:"%} <a href='{% url show-operation item.pk "odt" %}'>{%trans "OpenOffice.org file"%}</a>, <a href='{% url show-operation item.pk "pdf" %}'>{%trans "PDF file"%}</a></div>
<h3>{% trans "General"%}</h3>
<p><label>{%trans "Year:"%}</label> <span class='value'>{{ item.year }}</span></p>
-<p><label>{%trans "Numerical reference:"%}</label> <span class='value'>{{ item.operation_code }}</span></p>
+{% if item.operation.operation_code %}<p><label>{%trans "Numerical reference:"%}</label> <span class='value'>{{ item.operation_code }}</span></p>{% endif %}
{% if item.code_patriarche %}<p><label>{%trans "Patriarche OA code:"%}</label> <span class='value'>{{ item.code_patriarche }}</span></p>{%else%}
<p class='alert'>{%trans "Patriarche OA code not yet recorded!"%}</p>{%endif%}