From 44569ae382aa9422adfb0c8746ad409f5540d942 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 21 Aug 2013 18:31:27 +0200 Subject: Change find display IDs: complete_id and short_id (refs #1319) --- .../templates/ishtar/sheet_contextrecord.html | 14 ++++++------- archaeological_finds/models.py | 24 ++++++++++++++++++++++ .../templates/ishtar/sheet_operation.html | 12 +++++------ 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html index 5b89c15d4..41e8ebe2a 100644 --- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html @@ -99,8 +99,8 @@ - - + + @@ -112,12 +112,10 @@ {% for find in item.base_finds.all %} - -{# Displayed as (Patriarche operation code)-(Record unit label)-(Finds label). #} -{# or displayed as (Year)-(index)-(Record unit label)-(Finds label). #} - -{# Displayed as (Patriarche operation code)-(Record unit label)-(material code)-(Finds label indexed by material type). #} -{# or displayed as (Year)-(index)-(Record unit label)-(material code)-(Finds label indexed by material type) #} + {# OPE|MAT.CODE|UE|FIND_index #} + + {# OPE|FIND_index #} + {# TODO .all|join:", " ? #} 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"" diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index 45c43598f..e1ea28882 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -144,8 +144,8 @@
{%trans "Finds"%}
{% trans "Find Id" %}{% trans "Id by material type" %}{% trans "Complete Id" %}{% trans "Short Id" %} {% trans "Material type" %} {% trans "Context record" context "short"%} {% trans "Periods" %}
{{ find.full_label }}{{ find.material_type_label }}{{ find.complete_id|default:""}}{{ find.short_id|default:"" }} {{ find.get_last_find.material_type|default:"" }} {{find.context_record.label}} {{ find.get_last_find.dating}}
- - + + @@ -158,10 +158,10 @@ {% for context_record in item.context_record.all %} {% for find in context_record.base_finds.all %} - -{# Displayed as (Patriarche operation code)-(Record unit label)-(Finds label). #} -{# or displayed as (Year)-(index)-(Record unit label)-(Finds label). #} - + {# OPE|MAT.CODE|UE|FIND_index #} + + {# OPE|FIND_index #} + {# TODO .all|join:", " ? #} -- cgit v1.2.3
{%trans "Finds"%}
{% trans "Find Id" %}{% trans "Id by material type" %}{% trans "Complete Id" %}{% trans "Short Id" %} {% trans "Material type" %} {% trans "Context record" context "short"%} {% trans "Periods" %}
{{ find.full_label }}{{ find.material_type_label }}{{ find.complete_id|default:""}}{{ find.short_id|default:"" }} {{ find.get_last_find.material_type|default:"" }} {{find.context_record.label}} {{ find.get_last_find.dating}}