summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2015-01-29 00:08:22 +0100
committerÉtienne Loks <etienne.loks@proxience.com>2015-01-29 00:08:22 +0100
commit999eefae2632bb01a968d088ccd6406f7b0bc896 (patch)
treeaab855539a05f8b9c3dec8df43a7bd01b1adbed4
parent30463969536705fda601c762ca459b4e51fbb3c5 (diff)
downloadIshtar-999eefae2632bb01a968d088ccd6406f7b0bc896.tar.bz2
Ishtar-999eefae2632bb01a968d088ccd6406f7b0bc896.zip
Fix display of operations - fix bibracte import of operations
-rw-r--r--archaeological_operations/data_importer.py3
-rw-r--r--archaeological_operations/models.py3
-rw-r--r--archaeological_operations/templates/ishtar/sheet_operation.html23
-rw-r--r--ishtar_common/data_importer.py3
-rw-r--r--ishtar_common/models.py2
5 files changed, 24 insertions, 10 deletions
diff --git a/archaeological_operations/data_importer.py b/archaeological_operations/data_importer.py
index cad929d20..c1fd99fe1 100644
--- a/archaeological_operations/data_importer.py
+++ b/archaeological_operations/data_importer.py
@@ -173,7 +173,8 @@ class OperationImporterBibracte(Importer):
# fin
ImportFormater('excavation_end_date', DateFormater('%Y/%m/%d'),),
# Chronos
- ImportFormater('periods', TypeFormater(models.Period, many_split="&")),
+ ImportFormater('periods', TypeFormater(models.Period, many_split="&"),
+ required=False),
]
RE_PARCEL_SECT_NUM = re.compile("([A-Za-z]*)([0-9]*)")
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 5d8c93ecf..5e3b05097 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -365,7 +365,8 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem,
if not self.operation_code:
return ""
lbl = unicode(self.operation_code)
- lbl = u"%d-%s%s" % (self.year, (3-len(lbl))*"0", lbl)
+ year = self.year or 0
+ lbl = u"%d-%s%s" % (year, (3-len(lbl))*"0", lbl)
return lbl
def clean(self):
diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html
index 138a94d14..5f0626a02 100644
--- a/archaeological_operations/templates/ishtar/sheet_operation.html
+++ b/archaeological_operations/templates/ishtar/sheet_operation.html
@@ -27,7 +27,7 @@
<h3>{% trans "General"%}</h3>
{% if item.common_name %}<p><label>{%trans "Name:"%}</label> <span class='value'>{{ item.common_name }}</span></p>{% endif %}
-<p><label>{%trans "Year:"%}</label> <span class='value strong'>{{ item.year }}</span></p>
+{% if item.year %}<p><label>{%trans "Year:"%}</label> <span class='value strong'>{{ item.year }}</span></p>{% endif %}
{% if item.operation_code %}<p><label>{%trans "Numerical reference:"%}</label> <span class='value strong'>{{ item.operation_code }}</span></p>{% endif %}
{% if item.code_patriarche %}<p><label>{%trans "Patriarche OA code:"%}</label> <span class='value'>{{ item.code_patriarche }}</span></p>{%else%}
@@ -90,7 +90,12 @@
{% endif %}
{% trans "Document from this operation" as operation_docs %}
-{% if item.source.count %} {% table_document operation_docs item.source.all %}{% endif %}
+{% if item.source.count %}
+{% table_document operation_docs item.source.all|slice:":15" %}
+{% if item.source.count > 15 %}
+<em>Seuls les 15 premiers éléments ont été affichés sur un total de {{item.source.count}}.</em>
+{% endif %}
+{% endif %}
<table>
<caption>{%trans "Context records"%}</caption>
@@ -102,7 +107,7 @@
<th>{% trans "Parcel" %}</th>
<th class='link'>&nbsp;</th>
</tr>
- {% for context_record in item.context_record.all %}
+ {% for context_record in item.context_record.all|slice:"15" %}
<tr>
<td class='string'>{{ context_record.label }}</td>
<td class='string'>{{context_record.unit|default:""}}</td>
@@ -115,9 +120,12 @@
<tr><td colspan="6" class='no_items'>{% trans "No context record associated to this operation" %}</td></tr>
{% endfor %}
</table>
+{% if item.context_record.count > 15 %}
+<em>Seuls les 15 premiers éléments ont été affichés sur un total de {{item.context_record.count}}.</em>
+{% endif %}
{% trans "Documents from associated context records" as cr_docs %}
-{% if item.context_record_docs_q.count %} {% table_document cr_docs item.context_record_docs_q.all %}{% endif %}
+{% if item.context_record_docs_q.count %} {% table_document cr_docs item.context_record_docs_q.all|slice:"15" %}{% endif %}
<div class='table'>
<table>
@@ -136,8 +144,8 @@
<th>{% trans "Warehouse" %}</th>
<th class='link'>&nbsp;</th>
</tr>
- {% for context_record in item.context_record.all %}
- {% for find in context_record.base_finds.all %}
+ {% for context_record in item.context_record.all|slice:"5" %}
+ {% for find in context_record.base_finds.all|slice:"15" %}
<tr>
{# OPE|MAT.CODE|UE|FIND_index #}
<td class="ref">{{ find.complete_id|default:""}}</td>
@@ -163,8 +171,11 @@
{% endfor %}
</table>
</div>
+<em>Seuls les 15 premiers éléments des 5 premières UEs sont affichées</em>
+{% comment %}
{% trans "Documents from associated finds" as find_docs %}
{% if item.find_docs_q.count %} {% table_document find_docs item.find_docs_q.all %}{% endif %}
+{% endcomment %}
{% endblock %}
diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py
index cde464e04..c2924a541 100644
--- a/ishtar_common/data_importer.py
+++ b/ishtar_common/data_importer.py
@@ -673,8 +673,7 @@ class Importer(object):
values = [v]
many_values = getattr(func, 'many_split', None)
if many_values:
- values = re.compile(func.many_split).split(values)
-
+ values = re.split(func.many_split, values[0])
formated_values = []
for idx, v in enumerate(values):
value = None
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index ab558ce75..af43f28e9 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -1132,6 +1132,8 @@ class Person(Address, Merge, OwnPerms, ValueGetter) :
values += [unicode(getattr(self, attr))
for attr in ('surname', 'name')
if getattr(self, attr)]
+ if not values and self.raw_name:
+ values = [self.raw_name]
if self.attached_to:
values.append(u"- " + unicode(self.attached_to))
return u" ".join(values)