diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2015-02-16 04:24:05 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-05-06 15:48:16 +0200 |
commit | 9ca3684e3edd18ac3e79426f019b9d0df6ad9067 (patch) | |
tree | 7305448c5f1917ee966f58a97ecb90d442fe5413 /archaeological_operations/models.py | |
parent | d580a4797ef5831a2151a5d481d65a161cd024f9 (diff) | |
download | Ishtar-9ca3684e3edd18ac3e79426f019b9d0df6ad9067.tar.bz2 Ishtar-9ca3684e3edd18ac3e79426f019b9d0df6ad9067.zip |
Modify short label of archaeological files and operations (refs #2285)
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 13 |
1 files changed, 10 insertions, 3 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) |