summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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%}