summaryrefslogtreecommitdiff
path: root/archaeological_context_records
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_context_records')
-rw-r--r--archaeological_context_records/forms.py2
-rw-r--r--archaeological_context_records/locale/django.pot107
-rw-r--r--archaeological_context_records/models.py19
-rw-r--r--archaeological_context_records/templates/ishtar/sheet_contextrecord.html30
-rw-r--r--archaeological_context_records/urls.py2
-rw-r--r--archaeological_context_records/views.py7
6 files changed, 98 insertions, 69 deletions
diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py
index d468e3a3c..4a5267654 100644
--- a/archaeological_context_records/forms.py
+++ b/archaeological_context_records/forms.py
@@ -214,7 +214,7 @@ class RecordFormGeneral(ManageOldType, forms.Form):
cr = models.ContextRecord.objects.filter(
label=label, parcel__operation__pk=operation_id)
if 'pk' in cleaned_data and cleaned_data['pk']:
- cr = cr.exclude(pk=cleaned_data['pk'])
+ cr = cr.exclude(pk=int(cleaned_data['pk']))
if cr.count():
raise forms.ValidationError(_(u"This ID already exists for "
u"this operation."))
diff --git a/archaeological_context_records/locale/django.pot b/archaeological_context_records/locale/django.pot
index 083f7e455..c2fe20b14 100644
--- a/archaeological_context_records/locale/django.pot
+++ b/archaeological_context_records/locale/django.pot
@@ -12,7 +12,6 @@ msgid "Operation"
msgstr ""
#: forms.py:59 forms.py:137 models.py:145
-#: templates/ishtar/sheet_contextrecord.html:65
msgid "ID"
msgstr ""
@@ -52,7 +51,7 @@ msgstr ""
msgid "Search within relations"
msgstr ""
-#: forms.py:111 forms.py:335 views.py:126
+#: forms.py:111 forms.py:335 views.py:133
msgid "Context record search"
msgstr ""
@@ -65,12 +64,10 @@ msgid "General"
msgstr ""
#: forms.py:136 models.py:131 models.py:141
-#: templates/ishtar/sheet_contextrecord.html:69
msgid "Parcel"
msgstr ""
#: forms.py:139 models.py:146 templates/ishtar/sheet_contextrecord.html:25
-#: templates/ishtar/sheet_contextrecord.html:68
msgid "Description"
msgstr ""
@@ -137,7 +134,7 @@ msgstr ""
msgid "Dating type"
msgstr ""
-#: forms.py:261 ishtar_menu.py:29 models.py:384
+#: forms.py:261 ishtar_menu.py:29 models.py:403
msgid "Context record"
msgstr ""
@@ -391,7 +388,7 @@ msgstr ""
msgid "Inverse relation"
msgstr ""
-#: models.py:354 templates/ishtar/sheet_contextrecord.html:64
+#: models.py:354 models.py:378
msgid "Relation type"
msgstr ""
@@ -399,47 +396,83 @@ msgstr ""
msgid "Relation types"
msgstr ""
-#: models.py:368
+#: models.py:373
+msgid "ID (left)"
+msgstr ""
+
+#: models.py:374
+msgid "Unit (left)"
+msgstr ""
+
+#: models.py:375
+msgid "Parcel (left)"
+msgstr ""
+
+#: models.py:376
+msgid "Description (left)"
+msgstr ""
+
+#: models.py:377
+msgid "Periods (left)"
+msgstr ""
+
+#: models.py:379
+msgid "Unit (right)"
+msgstr ""
+
+#: models.py:380 models.py:381
+msgid "Parcel (right)"
+msgstr ""
+
+#: models.py:382
+msgid "Description (right)"
+msgstr ""
+
+#: models.py:383
+msgid "Periods (right)"
+msgstr ""
+
+#: models.py:387
msgid "Record relation"
msgstr ""
-#: models.py:369
+#: models.py:388
msgid "Record relations"
msgstr ""
-#: models.py:381
+#: models.py:400
msgid "Context record documentation"
msgstr ""
-#: models.py:382
+#: models.py:401
msgid "Context record documentations"
msgstr ""
-#: views.py:136
+#: views.py:143
msgid "New context record"
msgstr ""
-#: views.py:147
+#: views.py:154
msgid "Context record modification"
msgstr ""
-#: views.py:161
+#: views.py:168
msgid "Context record deletion"
msgstr ""
-#: views.py:166
+#: views.py:173
msgid "Context record: source search"
msgstr ""
-#: views.py:174
+#: views.py:181
msgid "Context record: new source"
msgstr ""
-#: views.py:182
+#: views.py:189
msgid "Context record: source modification"
msgstr ""
-#: views.py:197
+#: views.py:204
msgid "Context record: source deletion"
msgstr ""
@@ -455,71 +488,63 @@ msgstr ""
msgid "Datations"
msgstr ""
-#: templates/ishtar/sheet_contextrecord.html:59
-msgid "In relation with"
-msgstr ""
-
-#: templates/ishtar/sheet_contextrecord.html:66
-msgid "Type"
+#: templates/ishtar/sheet_contextrecord.html:58
+msgid "Context record relations"
msgstr ""
-#: templates/ishtar/sheet_contextrecord.html:67
-msgid "Chronology"
-msgstr ""
-
-#: templates/ishtar/sheet_contextrecord.html:89
+#: templates/ishtar/sheet_contextrecord.html:65
msgid "Operation summary"
msgstr ""
-#: templates/ishtar/sheet_contextrecord.html:91
+#: templates/ishtar/sheet_contextrecord.html:67
msgid "Patriarche OA code not yet recorded!"
msgstr ""
-#: templates/ishtar/sheet_contextrecord.html:98
+#: templates/ishtar/sheet_contextrecord.html:74
msgid "State:"
msgstr ""
-#: templates/ishtar/sheet_contextrecord.html:98
+#: templates/ishtar/sheet_contextrecord.html:74
msgid "Active file"
msgstr ""
-#: templates/ishtar/sheet_contextrecord.html:98
+#: templates/ishtar/sheet_contextrecord.html:74
msgid "Closed operation"
msgstr ""
-#: templates/ishtar/sheet_contextrecord.html:100
+#: templates/ishtar/sheet_contextrecord.html:76
msgid "Closing date:"
msgstr ""
-#: templates/ishtar/sheet_contextrecord.html:100
+#: templates/ishtar/sheet_contextrecord.html:76
msgid "by"
msgstr ""
-#: templates/ishtar/sheet_contextrecord.html:108
+#: templates/ishtar/sheet_contextrecord.html:84
msgid "Localisation"
msgstr ""
-#: templates/ishtar/sheet_contextrecord.html:109
+#: templates/ishtar/sheet_contextrecord.html:85
msgid "Towns:"
msgstr ""
-#: templates/ishtar/sheet_contextrecord.html:110
+#: templates/ishtar/sheet_contextrecord.html:86
msgid "Related operation:"
msgstr ""
-#: templates/ishtar/sheet_contextrecord.html:112
+#: templates/ishtar/sheet_contextrecord.html:88
msgid "No operation linked to this context unit!"
msgstr ""
-#: templates/ishtar/sheet_contextrecord.html:115
+#: templates/ishtar/sheet_contextrecord.html:91
msgid "Document from this context record"
msgstr ""
-#: templates/ishtar/sheet_contextrecord.html:120
+#: templates/ishtar/sheet_contextrecord.html:96
msgid "Finds"
msgstr ""
-#: templates/ishtar/sheet_contextrecord.html:125
+#: templates/ishtar/sheet_contextrecord.html:101
msgid "Documents from associated finds"
msgstr ""
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index 5dc943275..e1cb216a2 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -363,6 +363,25 @@ class RecordRelations(GeneralRecordRelations, models.Model):
right_record = models.ForeignKey(ContextRecord,
related_name='left_relations')
relation_type = models.ForeignKey(RelationType)
+ TABLE_COLS = [
+ "left_record__label", "left_record__unit", "left_record__parcel",
+ "left_record__datings__period", "left_record__description",
+ "relation_type",
+ "right_record__label", "right_record__unit", "right_record__parcel",
+ "right_record__datings__period", "right_record__description"]
+ TABLE_COLS_LBL = {
+ "left_record__label": _(u"ID (left)"),
+ "left_record__unit": _(u"Unit (left)"),
+ "left_record__parcel": _(u"Parcel (left)"),
+ "left_record__description": _(u"Description (left)"),
+ "left_record__datings__period": _(u"Periods (left)"),
+ "relation_type": _(u"Relation type"),
+ "right_record__label": _(u"Unit (right)"),
+ "right_record__unit": _(u"Parcel (right)"),
+ "right_record__parcel": _(u"Parcel (right)"),
+ "right_record__description": _(u"Description (right)"),
+ "right_record__datings__period": _(u"Periods (right)")
+ }
class Meta:
verbose_name = _(u"Record relation")
diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
index bd883ac0b..907697c9e 100644
--- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
+++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
@@ -55,36 +55,12 @@
</ul>
{% endif %}
+{% trans "Context record relations" as cr_rels %}
{% if item.right_relations.count %}
-<h3>{% trans "In relation with"%}</h3>
-<div class='clean-table'>
-<div class='clean-table-wrap'>
-<table>
- <tr>
- <th>{% trans "Relation type" %}</th>
- <th>{% trans "ID" %}</th>
- <th>{% trans "Type" %}</th>
- <th>{% trans "Chronology" %}</th>
- <th>{% trans "Description" %}</th>
- <th>{% trans "Parcel" %}</th>
- <th class='link'>&nbsp;</th>
- </tr>
- {% for relation in item.right_relations.all %}
- <tr>
- <td class='string'>{{ relation.relation_type }}</td>
- <td class='string'>{{ relation.right_record.label }}</td>
- <td class='string'>{{relation.right_record.unit|default:""}}</td>
- <td class='string'>{{ relation.right_record.datings.all|join:", " }}</td>{# periods ?#}
- <td class='string'>{{ relation.right_record.description }}</td>
- <td class='string'>{{ relation.right_record.parcel.section }} - {{relation.right_record.parcel.parcel_number}}</td>
- <td class='link'><a href="#" class='display_details' onclick='load_window("{%url show-contextrecord relation.right_record.pk ''%}")'><i class="fa fa-info-circle" aria-hidden="true"></i></a></td>
- </tr>
- {% endfor %}
-</table>
-</div></div>
-
+{% dynamic_table_document cr_rels 'context_records_relations' 'left_record' item.pk '' output %}
{% endif %}
+
{% if item.operation %}
<h3>{% trans "Operation summary"%}</h3>
{% if not item.operation.code_patriarche %}
diff --git a/archaeological_context_records/urls.py b/archaeological_context_records/urls.py
index a25559e29..24e8e06eb 100644
--- a/archaeological_context_records/urls.py
+++ b/archaeological_context_records/urls.py
@@ -92,6 +92,8 @@ urlpatterns += patterns(
url(r'get-contextrecord-shortcut/(?P<type>.+)?$',
'get_contextrecord', name='get-contextrecord-shortcut',
kwargs={'full': 'shortcut'}),
+ url(r'get-contextrecordrelation/(?P<type>.+)?$',
+ 'get_contextrecordrelation', name='get-contextrecordrelation'),
url(r'show-contextrecordsource(?:/(?P<pk>.+))?/(?P<type>.+)?$',
'show_contextrecordsource', name=models.ContextRecordSource.SHOW_URL),
url(r'get-contexrecordsource/(?P<type>.+)?$',
diff --git a/archaeological_context_records/views.py b/archaeological_context_records/views.py
index bc95473e6..0ced39b20 100644
--- a/archaeological_context_records/views.py
+++ b/archaeological_context_records/views.py
@@ -121,6 +121,13 @@ get_contextrecordsource = get_item(
'context_record__unit': 'context_record__unit__pk',
})
+get_contextrecordrelation = get_item(
+ models.RecordRelations, 'get_contextrecordrelation',
+ 'contextrecordrelation',
+ extra_request_keys={
+ "left_record__operation": "left_record__operation__pk"
+ })
+
record_search_wizard = SearchWizard.as_view([
('general-record_search', RecordFormSelection)],
label=_(u"Context record search"),