diff options
Diffstat (limited to 'archaeological_operations')
| -rw-r--r-- | archaeological_operations/models.py | 13 | ||||
| -rw-r--r-- | archaeological_operations/templates/ishtar/sheet_operation.html | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 9104b0d0d..53e572a20 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -204,7 +204,7 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, if settings.COUNTRY == 'fr': code_patriarche = models.IntegerField(u"Code PATRIARCHE", null=True, blank=True) - TABLE_COLS = ['code_patriarche'] + TABLE_COLS + TABLE_COLS = ['full_code_patriarche'] + TABLE_COLS code_dracar = models.CharField(u"Code DRACAR", max_length=10, null=True, blank=True) fnap_financing = models.FloatField(u"Financement FNAP (%)", @@ -291,12 +291,13 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, def get_reference(self, full=False): ref = "" if self.code_patriarche: - ref = unicode(self.code_patriarche) + ref = "OA" + unicode(self.code_patriarche) if not full: return ref if self.year and self.operation_code: if ref: ref += u" - " + ref += settings.OP_PREFIX ref += u"-".join((unicode(self.year), unicode(self.operation_code))) return ref or "00" @@ -370,9 +371,15 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, return "" lbl = unicode(self.operation_code) year = self.year or 0 - lbl = u"%d-%s%s" % (year, (3-len(lbl))*"0", lbl) + lbl = settings.OP_PREFIX + u"%d-%s%s" % (year, (3-len(lbl))*"0", lbl) return lbl + @property + def full_code_patriarche(self): + if not self.code_patriarche: + return '' + return u"OA" + unicode(self.code_patriarche) + def clean(self): objs = self.__class__.objects.filter(year=self.year, operation_code=self.operation_code) diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index 5f0626a02..cc69abda0 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -30,7 +30,7 @@ {% if item.year %}<p><label>{%trans "Year:"%}</label> <span class='value strong'>{{ item.year }}</span></p>{% endif %} {% if item.operation_code %}<p><label>{%trans "Numerical reference:"%}</label> <span class='value strong'>{{ 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%} +{% if item.code_patriarche %}<p><label>{%trans "Patriarche OA code:"%}</label> <span class='value'>OA{{ item.code_patriarche }}</span></p>{%else%} <p class='alert'>{%trans "Patriarche OA code not yet recorded!"%}</p>{%endif%} <p><label>{%trans "Edition date:"%}</label> <span class='value'>{% if item.history_date %}{{ item.history_date }}{% else %}{{ item.history.all.0.history_date }}{% endif %}</span></p> <!-- date = now --> |
