summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-03-19 17:33:37 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-03-19 17:33:37 +0100
commit1ce09b797cdff55127caf7ad78d3f4c9d7ff9c47 (patch)
tree656e6b4f57ae2386987a06dab0006b1a3c966b85
parent441ece7a95039679455eb45b029b8a84a4be508d (diff)
downloadIshtar-1ce09b797cdff55127caf7ad78d3f4c9d7ff9c47.tar.bz2
Ishtar-1ce09b797cdff55127caf7ad78d3f4c9d7ff9c47.zip
Treatments/Treatment files sheets: add source list (refs #3402)
-rw-r--r--archaeological_finds/models_treatments.py2
-rw-r--r--archaeological_finds/templates/ishtar/sheet_treatment.html5
-rw-r--r--archaeological_finds/templates/ishtar/sheet_treatmentfile.html7
-rw-r--r--ishtar_common/templatetags/window_tables.py7
4 files changed, 19 insertions, 2 deletions
diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py
index 2efedbc22..4a453f538 100644
--- a/archaeological_finds/models_treatments.py
+++ b/archaeological_finds/models_treatments.py
@@ -567,6 +567,7 @@ class TreatmentSource(Source):
Treatment, verbose_name=_(u"Treatment"), related_name="source")
BOOL_FIELDS = ['duplicate']
TABLE_COLS = ['treatment__cached_label'] + Source.TABLE_COLS
+ COL_LABELS = {'treatment__cached_label': _(u"Treatment")}
SHOW_URL = 'show-treatmentsource'
class Meta:
@@ -584,6 +585,7 @@ class TreatmentFileSource(Source):
related_name="source")
BOOL_FIELDS = ['duplicate']
TABLE_COLS = ['treatment_file__cached_label'] + Source.TABLE_COLS
+ COL_LABELS = {'treatment_file__cached_label': _(u"Treatment file")}
SHOW_URL = 'show-treatmentfilesource'
class Meta:
diff --git a/archaeological_finds/templates/ishtar/sheet_treatment.html b/archaeological_finds/templates/ishtar/sheet_treatment.html
index eeaa95dff..37688b267 100644
--- a/archaeological_finds/templates/ishtar/sheet_treatment.html
+++ b/archaeological_finds/templates/ishtar/sheet_treatment.html
@@ -56,6 +56,11 @@
{% trans "Related operations" as related_operations %}
{% dynamic_table_document related_operations 'operations' 'related_treatment' item.pk 'TABLE_COLS' output %}
+{% if item.source.count %}
+{% trans "Associated documents" as associated_docs %}
+{% dynamic_table_document associated_docs 'treatments_docs' 'treatment' item.pk '' output %}
+{% endif %}
+
{% if item.administrative_act.count %}
{% trans "Administrative acts" as admact_lbl %}
{% table_administrativact admact_lbl item.administrative_act.all %}
diff --git a/archaeological_finds/templates/ishtar/sheet_treatmentfile.html b/archaeological_finds/templates/ishtar/sheet_treatmentfile.html
index 4b7405192..81311deb8 100644
--- a/archaeological_finds/templates/ishtar/sheet_treatmentfile.html
+++ b/archaeological_finds/templates/ishtar/sheet_treatmentfile.html
@@ -42,11 +42,16 @@
{% field "Contact" item.applicant.address_lbl %}
{% endif %}
-{% trans "Treatments" as treatments %}
{% if item.treatments.count %}
+{% trans "Treatments" as treatments %}
{% dynamic_table_document treatments 'treatments' 'file' item.pk '' output '' 'treatment' %}
{% endif %}
+{% if item.source.count %}
+{% trans "Associated documents" as associated_docs %}
+{% dynamic_table_document associated_docs 'treatmentfiles_docs' 'treatment_file' item.pk '' output %}
+{% endif %}
+
{% if item.administrative_act.count %}
{% trans "Administrative acts" as admact_lbl %}
{% table_administrativact admact_lbl item.administrative_act.all %}
diff --git a/ishtar_common/templatetags/window_tables.py b/ishtar_common/templatetags/window_tables.py
index 05592557a..960bc7184 100644
--- a/ishtar_common/templatetags/window_tables.py
+++ b/ishtar_common/templatetags/window_tables.py
@@ -18,7 +18,8 @@ from archaeological_context_records.models import ContextRecord, \
ContextRecordSource, RecordRelationView, \
RecordRelations as CRRecordRelations
from archaeological_finds.models import Find, FindSource, \
- FindUpstreamTreatments, FindDownstreamTreatments, FindTreatments
+ FindUpstreamTreatments, FindDownstreamTreatments, FindTreatments, \
+ TreatmentSource, TreatmentFileSource
from archaeological_warehouse.models import Container
register = template.Library()
@@ -59,6 +60,10 @@ ASSOCIATED_MODELS['finds_downstreamtreatments'] = (
FindDownstreamTreatments, 'get-downstreamtreatment', '')
ASSOCIATED_MODELS['treatments'] = (
FindTreatments, 'get-treatment', '')
+ASSOCIATED_MODELS['treatments_docs'] = (
+ TreatmentSource, 'get-treatmentsource', '')
+ASSOCIATED_MODELS['treatmentfiles_docs'] = (
+ TreatmentFileSource, 'get-treatmentfilesource', '')
ASSOCIATED_MODELS['containers'] = (
Container, 'get-container', '')