summaryrefslogtreecommitdiff
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
parentd2eb227c7460a209280dccd5e251838470926026 (diff)
downloadIshtar-81a350fcca34b4252a53bd81a04f5788ce7ab910.tar.bz2
Ishtar-81a350fcca34b4252a53bd81a04f5788ce7ab910.zip
Change find display IDs: complete_id and short_id (refs #1319)
-rw-r--r--archaeological_context_records/templates/ishtar/sheet_contextrecord.html14
-rw-r--r--archaeological_finds/models.py24
-rw-r--r--archaeological_operations/templates/ishtar/sheet_operation.html12
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 @@
<table>
<caption>{%trans "Finds"%}</caption>
<tr>
- <th>{% trans "Find Id" %}</th>
- <th>{% trans "Id by material type" %}</th>
+ <th>{% trans "Complete Id" %}</th>
+ <th>{% trans "Short Id" %}</th>
<th>{% trans "Material type" %}</th>
<th>{% trans "Context record" context "short"%}</th>
<th>{% trans "Periods" %}</th>
@@ -112,12 +112,10 @@
</tr>
{% for find in item.base_finds.all %}
<tr>
- <td class='ref'>{{ find.full_label }}</td>
-{# Displayed as (Patriarche operation code)-(Record unit label)-(Finds label). #}
-{# or displayed as (Year)-(index)-(Record unit label)-(Finds label). #}
- <td class="ref">{{ find.material_type_label }}</td>
-{# 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 #}
+ <td class="ref">{{ find.complete_id|default:""}}</td>
+ {# OPE|FIND_index #}
+ <td class="ref">{{ find.short_id|default:"" }}</td>
<td class="string">{{ find.get_last_find.material_type|default:"" }}</td>
<td>{{find.context_record.label}}</td>
<td>{{ find.get_last_find.dating}}</td>{# 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 @@
<table>
<caption>{%trans "Finds"%}</caption>
<tr>
- <th>{% trans "Find Id" %}</th>
- <th>{% trans "Id by material type" %}</th>
+ <th>{% trans "Complete Id" %}</th>
+ <th>{% trans "Short Id" %}</th>
<th>{% trans "Material type" %}</th>
<th>{% trans "Context record" context "short"%}</th>
<th>{% trans "Periods" %}</th>
@@ -158,10 +158,10 @@
{% for context_record in item.context_record.all %}
{% for find in context_record.base_finds.all %}
<tr>
- <td class="ref">{{ find.full_label }}</td>
-{# Displayed as (Patriarche operation code)-(Record unit label)-(Finds label). #}
-{# or displayed as (Year)-(index)-(Record unit label)-(Finds label). #}
- <td class="ref">{{ find.material_type_label }}</td>
+ {# OPE|MAT.CODE|UE|FIND_index #}
+ <td class="ref">{{ find.complete_id|default:""}}</td>
+ {# OPE|FIND_index #}
+ <td class="ref">{{ find.short_id|default:"" }}</td>
<td class="string">{{ find.get_last_find.material_type|default:"" }}</td>
<td>{{find.context_record.label}}</td>
<td class='string'>{{ find.get_last_find.dating}}</td>{# TODO .all|join:", " ? #}