diff options
| 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 |
| commit | 44569ae382aa9422adfb0c8746ad409f5540d942 (patch) | |
| tree | 2533a69f0f87dae5bdd97f6fe4beb8995d067646 /archaeological_finds | |
| parent | a76ed5d91b0d12a9366e2ce94e3df34ce0cfebe8 (diff) | |
| download | Ishtar-44569ae382aa9422adfb0c8746ad409f5540d942.tar.bz2 Ishtar-44569ae382aa9422adfb0c8746ad409f5540d942.zip | |
Change find display IDs: complete_id and short_id (refs #1319)
Diffstat (limited to 'archaeological_finds')
| -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"" |
