summaryrefslogtreecommitdiff
path: root/archaeological_operations/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-06-30 17:26:44 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-06-30 17:26:44 +0200
commitffd57727a66952e12b5236e7567f5fd75eb7e5f8 (patch)
tree2b8ab152e92a95948e9a038ebcef815bfd56aa38 /archaeological_operations/models.py
parent2a0842c8ffb0e7eec6b350f9d170670c8376cce8 (diff)
parent18995ac80a961083ad986f4abe984fd649ec40e2 (diff)
downloadIshtar-ffd57727a66952e12b5236e7567f5fd75eb7e5f8.tar.bz2
Ishtar-ffd57727a66952e12b5236e7567f5fd75eb7e5f8.zip
Merge branch 'master' into develop
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 1ebf462a3..b982e7d45 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)