From 399b48288a2eda31dce54b64f2baf7494a675f37 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 29 Jan 2015 02:14:03 +0100 Subject: Add new fields to context record, find sheets. --- archaeological_context_records/data_importer.py | 2 +- archaeological_context_records/models.py | 4 +- .../templates/ishtar/sheet_contextrecord.html | 27 +++++++++++++ archaeological_finds/data_importer.py | 8 ++-- archaeological_finds/models.py | 3 +- .../templates/ishtar/sheet_find.html | 44 ++++++++++++++++++---- 6 files changed, 72 insertions(+), 16 deletions(-) diff --git a/archaeological_context_records/data_importer.py b/archaeological_context_records/data_importer.py index 0d04678c5..0bf6f83a1 100644 --- a/archaeological_context_records/data_importer.py +++ b/archaeological_context_records/data_importer.py @@ -35,7 +35,7 @@ class ContextRecordsImporterBibracte(Importer): ImportFormater('operation__operation_code', IntegerFormater(), duplicate_fields=['parcel__operation__operation_code'],), # ID UE - ImportFormater('external_id', UnicodeFormater(120),), + ImportFormater('external_id', UnicodeFormater(120), duplicate_fields=['label'],), # Type ImportFormater('unit', TypeFormater(models.Unit), required=False), # description diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 6a08e2f84..81d395ced 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -284,9 +284,9 @@ class RelationType(GeneralType): class RecordRelations(models.Model): left_record = models.ForeignKey(ContextRecord, - related_name='left_relations') + related_name='right_relations') right_record = models.ForeignKey(ContextRecord, - related_name='right_relations') + related_name='left_relations') relation_type = models.ForeignKey(RelationType) class Meta: diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html index 308c20289..1a18f1cd5 100644 --- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html @@ -64,6 +64,33 @@ {% if item.tpq_estimated %}

{{ item.tpq_estimated }}

{%endif%} {%endif%} +{% if item.right_relations.count %} +

{% trans "In relation with"%}

+ + + + + + + + + + + {% for relation in item.right_relations.all %} + + + + + {# periods ?#} + + + + + {% endfor %} +
{% trans "Relation type" %}{% trans "ID" %}{% trans "Type" %}{% trans "Chronology" %}{% trans "Description" %}{% trans "Parcel" %} 
{{ relation.relation_type }}{{ relation.right_record.label }}{{relation.right_record.unit|default:""}}{{ relation.right_record.datings.all|join:", " }}{{ relation.right_record.description }}{{ relation.right_record.parcel.section }} - {{relation.right_record.parcel.parcel_number}}
+ +{% endif %} + {% if item.operation %}

{% trans "Operation resume"%}

{{ item.operation.year }}

diff --git a/archaeological_finds/data_importer.py b/archaeological_finds/data_importer.py index cfcce7178..429cd4beb 100644 --- a/archaeological_finds/data_importer.py +++ b/archaeological_finds/data_importer.py @@ -37,7 +37,7 @@ class FindsImporterBibracte(Importer): IntegerFormater(),), # external_id ImportFormater('external_id', UnicodeFormater(120, notnull=True), - duplicate_fields=['find__external_id']), + duplicate_fields=['find__external_id', 'label', 'find__label']), # isolé ou non (si non isolé = lot) ImportFormater('is_isolated', StrToBoolean( choices={'lot':False, 'objet':True}), required=False), @@ -76,8 +76,9 @@ class FindsImporterBibracte(Importer): # comment ImportFormater('comment', UnicodeFormater(1000), required=False), # lien vers plusieurs chrono (voir gestion actuelle chrono) - ImportFormater('find__dating__period', TypeFormater(Period, - many_split="&"), required=False), + None, + #ImportFormater('find__dating__period', TypeFormater(Period, + # many_split="&"), required=False), # topographic_localisation ImportFormater('topographic_localisation', UnicodeFormater(120), required=False), @@ -90,7 +91,6 @@ class FindsImporterBibracte(Importer): None ] - class FindAltImporterBibracte(Importer): DESC = u"Exports Bibracte : importeur pour l'onglet prélèvement" OBJECT_CLS = models.BaseFind diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py index 7d5b3108d..1fb92f9d8 100644 --- a/archaeological_finds/models.py +++ b/archaeological_finds/models.py @@ -108,8 +108,9 @@ class BaseFind(BaseHistorizedItem, OwnPerms): return find = self.get_last_find() ope = self.context_record.operation - c_id = [unicode(ope.code_patriarche) or \ + c_id = [unicode(ope.code_patriarche) if ope.code_patriarche else (unicode(ope.year) + "-" + unicode(ope.operation_code))] + print c_id c_id.append(find and find.material_type.code or '') c_id.append(self.context_record.label) c_id.append(unicode(self.index)) diff --git a/archaeological_finds/templates/ishtar/sheet_find.html b/archaeological_finds/templates/ishtar/sheet_find.html index 0e5ddfac0..c5bd637a5 100644 --- a/archaeological_finds/templates/ishtar/sheet_find.html +++ b/archaeological_finds/templates/ishtar/sheet_find.html @@ -28,25 +28,35 @@ {% endif%} -

-{{item.label}}

+{% if item.label %}

+{{item.label}}

{% endif %} {% if item.description %}

{{item.description}}

{% endif%}

{{ item.history_creator.ishtaruser.full_label }}

{{item.material_type}}

-

-{{item.dating}}

+{% if item.dating %}

+{{item.dating}}

{% endif %} {% if item.volume %}

{{item.volume}}

{% endif%} -{% if item.weight %}

-{{item.weight}}

{% endif%} +{% if item.weight %}

+{{item.weight}} {% if item.weight_unit %}{{item.weight_unit}}{% else %}g{% endif %}

{% endif%} {% if item.find_number %}

{{item.find_number}}

{% endif%} + +{% if item.conservatory_state %} +

+{{item.conservatory_state}}

+{% endif %} +{% if item.preservation_to_consider %} +

+{{item.preservation_to_consider}}

+{% endif %} + {% if item.upstream_treatment %}

-{{item.upstream_treatment}}

{% endif%} +{{item.upstream_treatment}} ({% for up in item.upstream_treatment.upstream_treatment.all %}{% if forloop.counter0 %}, {%endif %}{{up}}{% endfor %})

{% endif%} {% if item.downstream_treatment %}

-{{item.downstream_treatment}}

{% endif%} +{{item.downstream_treatment}} ({% for dt in item.downstream_treatment.downstream_treatment.all %}{% if forloop.counter0 %}, {%endif %}{{dt}}{% endfor %})

{% endif%} {% if item.container %}

{{item.container}}

{% endif%} @@ -55,6 +65,24 @@ {% for base_find in item.base_finds.all %}

{{base_find.complete_id}}

+ +{% if base_find.discovery_date %} +

+{{base_find.discovery_date}}

+{% endif%} +{% if base_find.description %} +

+{{base_find.description}}

+{% endif%} +{% if base_find.comment %} +

+{{base_find.comment}}

+{% endif%} +{% if base_find.special_interest %} +

+{{base_find.special_interest}}

+{% endif%} +

{{ base_find.context_record }}

-- cgit v1.2.3