diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2011-07-10 19:32:10 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2011-07-10 19:32:10 +0200 |
commit | 71b8e41a3bdb78b89b35b2fcee8d1418fa9c3bc2 (patch) | |
tree | 4b5aad0a70b1803a63d4aa4ddec3914a7a210004 /ishtar/ishtar_base/models.py | |
parent | e6400e623dff8749bb530349091824ffe1217241 (diff) | |
download | Ishtar-71b8e41a3bdb78b89b35b2fcee8d1418fa9c3bc2.tar.bz2 Ishtar-71b8e41a3bdb78b89b35b2fcee8d1418fa9c3bc2.zip |
Correct operation index display (closes #436, closes #346)
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) |