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.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index bbffe023f..82567842f 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -391,10 +391,11 @@ class ActType(GeneralType):
ordering = ('label',)
class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter):
- TABLE_COLS = ['year', 'index', 'act_type', 'signature_date',
+ TABLE_COLS = ['full_ref', 'act_type', 'signature_date',
'associated_file', 'operation']
- TABLE_COLS_FILE = ['act_type', 'associated_file', 'associated_file.towns',]
- TABLE_COLS_OPE = ['act_type', 'operation', 'operation.towns']
+ TABLE_COLS_FILE = ['full_ref', 'act_type', 'associated_file',
+ 'associated_file.towns',]
+ TABLE_COLS_OPE = ['full_ref', 'act_type', 'operation', 'operation.towns']
act_type = models.ForeignKey(ActType, verbose_name=_(u"Act type"))
in_charge = models.ForeignKey(Person, blank=True, null=True,
related_name='+', verbose_name=_(u"Person in charge of the operation"))
@@ -442,6 +443,18 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter):
for item in [self.operation, self.associated_file, self.act_object]
if item])
+ full_ref_lbl = _(u"Ref.")
+ @property
+ def full_ref(self):
+ lbl = []
+ if self.year:
+ lbl.append(unicode(self.year))
+ if self.index:
+ lbl.append(u"n°%d" %self.index)
+ if settings.COUNTRY == 'fr' and self.ref_sra:
+ lbl.append(u"[%s]" % self.ref_sra)
+ return u" ".join(lbl)
+
@property
def year(self):
if not self.signature_date:
@@ -485,7 +498,7 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter):
def save(self, *args, **kwargs):
if not self.act_type.indexed or not self.signature_date:
- super(AdministrativeAct, self).save(*args, **kwargs)
+ return super(AdministrativeAct, self).save(*args, **kwargs)
year = self.signature_date.year
if not self.index:
c_index = 1