diff options
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 |
commit | fb8217c5d1581aec760c1163943c367b36f3f820 (patch) | |
tree | 5c503e04e6b2e3450904b2b21dfa84194008082b /archaeological_operations/models.py | |
parent | 5a616ab12800f0647414824ec000ef05e64074fd (diff) | |
download | Ishtar-fb8217c5d1581aec760c1163943c367b36f3f820.tar.bz2 Ishtar-fb8217c5d1581aec760c1163943c367b36f3f820.zip |
Django admin: fix index modifications (refs #1884)
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 12 |
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) |