diff options
Diffstat (limited to 'ishtar/ishtar_base/models.py')
| -rw-r--r-- | ishtar/ishtar_base/models.py | 13 | 
1 files changed, 10 insertions, 3 deletions
| diff --git a/ishtar/ishtar_base/models.py b/ishtar/ishtar_base/models.py index 8c4c91dae..192b3e787 100644 --- a/ishtar/ishtar_base/models.py +++ b/ishtar/ishtar_base/models.py @@ -626,8 +626,8 @@ class RemainType(GeneralType):          verbose_name_plural = _(u"Remain types")  class Operation(BaseHistorizedItem, OwnPerms): -    TABLE_COLS = ['operation_code', 'year', 'operation_type', -                  'remains', 'towns', 'associated_file', 'start_date'] +    TABLE_COLS = ['year_index', 'operation_type', 'remains', 'towns', +                  'associated_file', 'start_date', 'excavation_end_date']      start_date = models.DateField(_(u"Start date"), null=True, blank=True)      excavation_end_date = models.DateField(_(u"Excavation end date"), null=True,                                             blank=True) @@ -648,11 +648,11 @@ class Operation(BaseHistorizedItem, OwnPerms):      if settings.COUNTRY == 'fr':          code_patriarche = models.IntegerField(u"Code PATRIARCHE", null=True,                                                blank=True) +        TABLE_COLS = ['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",                                               blank=True, null=True) -        TABLE_COLS += ["code_patriarche"]          zoning_prescription = models.NullBooleanField(                              _(u"Prescription on zoning"), blank=True, null=True)          large_area_prescription = models.NullBooleanField( @@ -680,6 +680,13 @@ class Operation(BaseHistorizedItem, OwnPerms):                                 unicode(self.operation_code))))          return JOINT.join(items) +    year_index_lbl = _(u"Operation code") +    @property +    def year_index(self): +        lbl = unicode(self.operation_code) +        lbl = u"%d-%s%s" % (self.year, (3-len(lbl))*"0", lbl) +        return lbl +      def clean(self):          objs = self.__class__.objects.filter(year=self.year,                                               operation_code=self.operation_code) | 
