diff options
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index fb8cd722b..3011d8076 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -206,7 +206,7 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, if settings.COUNTRY == 'fr': code_patriarche = models.IntegerField(u"Code PATRIARCHE", null=True, blank=True, unique=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 (%)", @@ -293,12 +293,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" @@ -372,9 +373,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): if not self.operation_code: return @@ -682,7 +689,8 @@ class Parcel(LightHistorizedItem): town = models.ForeignKey(Town, related_name='parcels', verbose_name=_(u"Town")) section = models.CharField(_(u"Section"), max_length=4) - parcel_number = models.CharField(_(u"Parcel number"), max_length=6) + parcel_number = models.CharField(_(u"Parcel number"), max_length=6, + null=True, blank=True) external_id = models.CharField(_(u"External ID"), max_length=12, null=True, blank=True) address = models.TextField(_(u"Address - Locality"), null=True, blank=True) |