diff options
Diffstat (limited to 'archaeological_finds/models.py')
-rw-r--r-- | archaeological_finds/models.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py index b559f6991..e4ccaf212 100644 --- a/archaeological_finds/models.py +++ b/archaeological_finds/models.py @@ -71,6 +71,30 @@ class BaseFind(BaseHistorizedItem, OwnPerms): finds = self.find.filter().order_by("-order").all() return finds and finds[0] + def complete_id(self): + # OPE|MAT.CODE|UE|FIND_index + if not self.context_record.operation: + return + find = self.get_last_find() + ope = self.context_record.operation + c_id = [ope.code_patriarche or \ + (unicode(ope.year) + "-" + unicode(ope.operation_code))] + c_id.append(find and find.material_type.code or '') + c_id.append(self.context_record.label) + c_id.append(unicode(self.index)) + return settings.JOINT.join(c_id) + + def short_id(self): + # OPE|FIND_index + if not self.context_record.operation: + return + find = self.get_last_find() + ope = self.context_record.operation + c_id = [ope.code_patriarche or \ + (unicode(ope.year) + "-" + unicode(ope.operation_code))] + c_id.append(unicode(self.index)) + return settings.JOINT.join(c_id) + def full_label(self): return self._real_label() or self._temp_label() or u"" |