summaryrefslogtreecommitdiff
path: root/archaeological_operations/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2014-07-15 19:51:41 +0200
committerÉtienne Loks <etienne.loks@proxience.com>2014-07-15 19:51:41 +0200
commit9e6234d97315eb943b3cb293de6f31a59c7f7f60 (patch)
tree5c503e04e6b2e3450904b2b21dfa84194008082b /archaeological_operations/models.py
parentafa94b470a1e487a045bb24edf9054fdddfa0209 (diff)
downloadIshtar-9e6234d97315eb943b3cb293de6f31a59c7f7f60.tar.bz2
Ishtar-9e6234d97315eb943b3cb293de6f31a59c7f7f60.zip
Django admin: fix index modifications (refs #1884)
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r--archaeological_operations/models.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index f6ac43239..d37422f3d 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -495,7 +495,8 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter):
signature_date = models.DateField(_(u"Signature date"), blank=True,
null=True)
year = models.IntegerField(_(u"Year"), blank=True, null=True)
- act_object = models.CharField(_(u"Object"), max_length=200)
+ act_object = models.TextField(_(u"Object"), max_length=200, blank=True,
+ null=True)
if settings.COUNTRY == 'fr':
ref_sra = models.CharField(u"Référence SRA", max_length=15, blank=True,
null=True)
@@ -594,6 +595,15 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter):
else:
self._get_index()
+ def clean(self, *args, **kwargs):
+ if not self.signature_date:
+ return super(AdministrativeAct, self).clean(*args, **kwargs)
+ self.year = self.signature_date.year
+ if not self.act_type.indexed:
+ return super(AdministrativeAct, self).clean(*args, **kwargs)
+ self._get_index()
+ super(AdministrativeAct, self).clean(*args, **kwargs)
+
def save(self, *args, **kwargs):
if not self.signature_date:
return super(AdministrativeAct, self).save(*args, **kwargs)