summaryrefslogtreecommitdiff
path: root/archaeological_operations/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-06-14 00:13:06 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-06-14 00:13:06 +0200
commitee8ac4b2737d009d858360395b32b8277d4c6c3b (patch)
tree7c63d3f2e21b29c79d4c2dc6bedf91f8a64618b4 /archaeological_operations/models.py
parent9f7e16bc051d7ae8967520c6a4ccaed00ae9cb4c (diff)
parent9fe30e305e1a114277e8473df415588bfacd188d (diff)
downloadIshtar-ee8ac4b2737d009d858360395b32b8277d4c6c3b.tar.bz2
Ishtar-ee8ac4b2737d009d858360395b32b8277d4c6c3b.zip
Merge branch 'v0.9' into wheezy
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)