summaryrefslogtreecommitdiff
path: root/archaeological_finds
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2013-08-21 18:31:27 +0200
committerÉtienne Loks <etienne.loks@peacefrogs.net>2013-08-21 18:31:27 +0200
commit81a350fcca34b4252a53bd81a04f5788ce7ab910 (patch)
tree2533a69f0f87dae5bdd97f6fe4beb8995d067646 /archaeological_finds
parentd2eb227c7460a209280dccd5e251838470926026 (diff)
downloadIshtar-81a350fcca34b4252a53bd81a04f5788ce7ab910.tar.bz2
Ishtar-81a350fcca34b4252a53bd81a04f5788ce7ab910.zip
Change find display IDs: complete_id and short_id (refs #1319)
Diffstat (limited to 'archaeological_finds')
-rw-r--r--archaeological_finds/models.py24
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""