diff options
Diffstat (limited to 'archaeological_context_records')
| -rw-r--r-- | archaeological_context_records/locale/django.pot | 44 | ||||
| -rw-r--r-- | archaeological_context_records/templates/ishtar/sheet_contextrecord.html | 16 | ||||
| -rw-r--r-- | archaeological_context_records/tests.py | 33 |
3 files changed, 72 insertions, 21 deletions
diff --git a/archaeological_context_records/locale/django.pot b/archaeological_context_records/locale/django.pot index 5683270f5..fe47dae4f 100644 --- a/archaeological_context_records/locale/django.pot +++ b/archaeological_context_records/locale/django.pot @@ -68,7 +68,7 @@ msgid "Parcel" msgstr "" #: forms.py:139 models.py:201 models.py:536 -#: templates/ishtar/sheet_contextrecord.html:27 +#: templates/ishtar/sheet_contextrecord.html:39 msgid "Description" msgstr "" @@ -148,7 +148,7 @@ msgid "Relations" msgstr "" #: forms.py:289 forms.py:297 models.py:223 -#: templates/ishtar/sheet_contextrecord.html:39 +#: templates/ishtar/sheet_contextrecord.html:51 msgid "Interpretation" msgstr "" @@ -509,67 +509,75 @@ msgstr "" msgid "Temporary ID:" msgstr "" -#: templates/ishtar/sheet_contextrecord.html:51 +#: templates/ishtar/sheet_contextrecord.html:18 +msgid "Creation:" +msgstr "" + +#: templates/ishtar/sheet_contextrecord.html:25 +msgid "Modification:" +msgstr "" + +#: templates/ishtar/sheet_contextrecord.html:63 msgid "Datations" msgstr "" -#: templates/ishtar/sheet_contextrecord.html:60 +#: templates/ishtar/sheet_contextrecord.html:72 msgid "Context record relations" msgstr "" -#: templates/ishtar/sheet_contextrecord.html:67 +#: templates/ishtar/sheet_contextrecord.html:79 msgid "Operation summary" msgstr "" -#: templates/ishtar/sheet_contextrecord.html:69 +#: templates/ishtar/sheet_contextrecord.html:81 msgid "Patriarche OA code not yet recorded!" msgstr "" -#: templates/ishtar/sheet_contextrecord.html:76 +#: templates/ishtar/sheet_contextrecord.html:88 msgid "State:" msgstr "" -#: templates/ishtar/sheet_contextrecord.html:76 +#: templates/ishtar/sheet_contextrecord.html:88 msgid "Active file" msgstr "" -#: templates/ishtar/sheet_contextrecord.html:76 +#: templates/ishtar/sheet_contextrecord.html:88 msgid "Closed operation" msgstr "" -#: templates/ishtar/sheet_contextrecord.html:78 +#: templates/ishtar/sheet_contextrecord.html:90 msgid "Closing date:" msgstr "" -#: templates/ishtar/sheet_contextrecord.html:78 +#: templates/ishtar/sheet_contextrecord.html:90 msgid "by" msgstr "" -#: templates/ishtar/sheet_contextrecord.html:86 +#: templates/ishtar/sheet_contextrecord.html:98 msgid "Localisation" msgstr "" -#: templates/ishtar/sheet_contextrecord.html:87 +#: templates/ishtar/sheet_contextrecord.html:99 msgid "Towns:" msgstr "" -#: templates/ishtar/sheet_contextrecord.html:88 +#: templates/ishtar/sheet_contextrecord.html:100 msgid "Related operation:" msgstr "" -#: templates/ishtar/sheet_contextrecord.html:90 +#: templates/ishtar/sheet_contextrecord.html:102 msgid "No operation linked to this context unit!" msgstr "" -#: templates/ishtar/sheet_contextrecord.html:93 +#: templates/ishtar/sheet_contextrecord.html:105 msgid "Document from this context record" msgstr "" -#: templates/ishtar/sheet_contextrecord.html:98 +#: templates/ishtar/sheet_contextrecord.html:110 msgid "Finds" msgstr "" -#: templates/ishtar/sheet_contextrecord.html:103 +#: templates/ishtar/sheet_contextrecord.html:115 msgid "Documents from associated finds" msgstr "" diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html index e44597961..1c024dcfc 100644 --- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html @@ -15,8 +15,20 @@ <ul class='form-flex'> <li><label>{% if item.operation.code_patriarche %}{%trans "Complete ID:"%}{% else %}{%trans "Temporary ID:"%}{% endif %}</label><span class='value'>{{item.full_label}}</span></li> -{% field_li "Creation date" item.creation_date %} -{% field_li_detail "Created by" item.history_creator.ishtaruser.person %} +<li><label>{%trans "Creation:"%}</label> + <span class='value'> + {{item.history_creator.ishtaruser.person}}<br/> + <small><em>{{item.history_creation_date|date:"DATETIME_FORMAT"}}</em></small> + </span> +</li> + {% if item.history_creation_date != item.last_edition_date %} +<li><label>{%trans "Modification:"%}</label> + <span class='value'> + {{item.history_modifier.ishtaruser.person}}<br/> + <small><em>{% firstof item.history_date|date:"DATETIME_FORMAT" item.history.all.0.history_date|date:"DATETIME_FORMAT" %}</em></small> + </span> +</li> + {% endif %} {% field_li "Type" item.unit %} {% field_li_multiple "Chronology" item.datings %} {% field_li "Town" item.parcel.town %} diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py index 2e1355572..c9795fce7 100644 --- a/archaeological_context_records/tests.py +++ b/archaeological_context_records/tests.py @@ -17,7 +17,9 @@ # See the file COPYING for details. +import csv import json +from StringIO import StringIO from django.conf import settings from django.core.exceptions import ValidationError, ImproperlyConfigured @@ -26,6 +28,7 @@ from django.test.client import Client from ishtar_common.models import IshtarSiteProfile, ImporterModel from ishtar_common.tests import create_superuser, TestCase + from archaeological_operations.tests import OperationInitTest, \ ImportTest, ImportOperationTest from archaeological_operations import models as models_ope @@ -183,6 +186,35 @@ class ContextRecordInit(OperationInitTest): super(ContextRecordInit, self).tearDown() +class ExportTest(ContextRecordInit, TestCase): + fixtures = ImportContextRecordTest.fixtures + + def setUp(self): + self.username, self.password, self.user = create_superuser() + + def test_ishtar_export_ue(self): + ope = self.create_operation()[0] + ope.code_patriarche = "45000" + ope.save() + cr = self.create_context_record(data={"label": u"CR 1"})[0] + c = Client() + url = reverse('get-by-importer', + kwargs={'slug': 'ishtar-context-record', + 'type': 'csv'}) + response = c.get(url) + # no result when no authentication + self.assertTrue(not response.content) + c.login(username=self.username, password=self.password) + response = c.get(url) + rows = list(csv.reader(StringIO(response.content))) + # one header + one context record + self.assertEqual(len(rows), 2) + row_cr = rows[1] + self.assertEqual(row_cr[0], '45000') + self.assertEqual(row_cr[1], '12345') + self.assertEqual(row_cr[2], 'A1') + + class ContextRecordTest(ContextRecordInit, TestCase): fixtures = ImportContextRecordTest.fixtures @@ -254,7 +286,6 @@ class ContextRecordTest(ContextRecordInit, TestCase): self.assertEqual(ope_id, 'OP2017-1') - class ContextRecordSearchTest(ContextRecordInit, TestCase): fixtures = ImportContextRecordTest.fixtures |
