diff options
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 307d02e97..7507da817 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -1037,7 +1037,7 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter): def __unicode__(self): return settings.JOINT.join( [unicode(item) for item in [ - self.operation, self.associated_file, self.act_object] + self.related_item, self.act_object] if item]) full_ref_lbl = _(u"Ref.") @@ -1054,6 +1054,10 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter): return u" ".join(lbl) @property + def associated_filename(self): + return self.get_filename() + + @property def towns(self): if self.associated_file: return self.associated_file.towns.all() @@ -1081,7 +1085,14 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter): @property def related_item(self): - return self.operation if self.operation else self.associated_file + if self.operation: + return self.operation + if self.associated_file: + return self.associated_file + if self.treatment: + return self.treatment + if self.treatment_file: + return self.treatment_file def get_filename(self): filename = self.related_item.associated_filename |