summaryrefslogtreecommitdiff
path: root/archaeological_operations/models.py
diff options
context:
space:
mode:
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)