summaryrefslogtreecommitdiff
path: root/archaeological_operations/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-06-13 13:04:16 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-06-13 13:04:16 +0200
commit04be2c3f89867d2b8ae21ccb475066016bac487d (patch)
tree4ae4ae5c72d4391836ed1d346999e38aa4d48509 /archaeological_operations/models.py
parent99b70dd1e0724e08e55d99185407caada9ab5eaf (diff)
downloadIshtar-04be2c3f89867d2b8ae21ccb475066016bac487d.tar.bz2
Ishtar-04be2c3f89867d2b8ae21ccb475066016bac487d.zip
OA code is now a string.
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r--archaeological_operations/models.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 3826678c3..c4fd0d96e 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -306,8 +306,8 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,
old_code = models.CharField(_(u"Old code"), max_length=200, null=True,
blank=True)
if settings.COUNTRY == 'fr':
- code_patriarche = models.IntegerField(u"Code PATRIARCHE", null=True,
- blank=True, unique=True)
+ code_patriarche = models.TextField(u"Code PATRIARCHE", null=True,
+ blank=True, unique=True)
TABLE_COLS = ['full_code_patriarche'] + TABLE_COLS
# preventive
fnap_financing = models.FloatField(u"Financement FNAP (%)",
@@ -548,7 +548,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,
def full_code_patriarche(self):
if not self.code_patriarche:
return ''
- return settings.ISHTAR_OPE_PREFIX + unicode(self.code_patriarche)
+ return settings.ISHTAR_OPE_PREFIX + self.code_patriarche
def clean(self):
if not self.operation_code:
@@ -783,6 +783,8 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,
self.year = self.start_date.year
if self.operation_code is None:
self.operation_code = self.get_available_operation_code(self.year)
+ if hasattr(self, 'code_patriarche'):
+ self.code_patriarche = self.code_patriarche or None
return super(Operation, self).save(*args, **kwargs)