summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2019-02-18 11:24:25 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-02-18 11:24:25 +0100
commit017e64157873dd01d6240fb62cdfee4ac5ca4e9d (patch)
tree92adea84e14590d18bf3caaa996f893a8f9cd3fd
parent09a78d33cdb239e7de40fa20d166d978298bedae (diff)
downloadIshtar-017e64157873dd01d6240fb62cdfee4ac5ca4e9d.tar.bz2
Ishtar-017e64157873dd01d6240fb62cdfee4ac5ca4e9d.zip
Sheet person: add related items tables
-rw-r--r--archaeological_finds/models_treatments.py6
-rw-r--r--archaeological_operations/models.py12
-rw-r--r--archaeological_warehouse/models.py5
-rw-r--r--ishtar_common/templates/ishtar/sheet_person.html47
-rw-r--r--ishtar_common/templatetags/window_tables.py16
5 files changed, 75 insertions, 11 deletions
diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py
index 9fc130af5..e2882df35 100644
--- a/archaeological_finds/models_treatments.py
+++ b/archaeological_finds/models_treatments.py
@@ -77,6 +77,7 @@ class Treatment(DashboardFormItem, ValueGetter, BaseHistorizedItem,
"downstream_cached_label": "downstream__cached_label",
"upstream_cached_label": "upstream__cached_label",
'person__cached_label': 'person__cached_label',
+ "person__pk": "person__pk", # used by dynamic_table_documents
}
COL_LABELS = {
"downstream_cached_label": _(u"Downstream find"),
@@ -867,7 +868,10 @@ class TreatmentFile(DashboardFormItem, ClosedItem, BaseHistorizedItem,
INT_SEARCH_VECTORS = ['year', 'index']
PARENT_SEARCH_VECTORS = ['in_charge', 'applicant', 'applicant_organisation']
- EXTRA_REQUEST_KEYS = {}
+ EXTRA_REQUEST_KEYS = {
+ "in_charge__pk": "in_charge__pk", # used by dynamic_table_documents
+ "applicant__pk": "applicant__pk", # used by dynamic_table_documents
+ }
# alternative names of fields for searches
ALT_NAMES = {
'name': SearchAltName(
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index b5e6a7754..5769391ad 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -131,7 +131,10 @@ class ArchaeologicalSite(BaseHistorizedItem, OwnPerms, ValueGetter,
COL_LABELS = {'towns_label': _(u"Towns")}
- EXTRA_REQUEST_KEYS = {'towns_label': 'towns'}
+ EXTRA_REQUEST_KEYS = {
+ 'towns_label': 'towns',
+ 'collaborators__pk': 'collaborators__pk', # dynamic_table_documents
+ }
# alternative names of fields for searches
ALT_NAMES = {
@@ -524,9 +527,10 @@ class Operation(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter,
'related_treatment':
'context_record__base_finds__find__upstream_treatment__id',
'towns_label': 'towns',
- 'scientist__pk': 'scientist__pk',
- 'in_charge__pk': 'in_charge__pk',
- 'collaborators__pk': 'collaborators__pk',
+ 'scientist__pk': 'scientist__pk', # dynamic_table_documents
+ 'in_charge__pk': 'in_charge__pk', # dynamic_table_documents
+ 'collaborators__pk': 'collaborators__pk', # dynamic_table_documents
+ 'cira_rapporteur__pk': 'cira_rapporteur__pk' # dynamic_table_documents
}
COL_LABELS = {
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py
index d36d1a83c..ae1ef5e47 100644
--- a/archaeological_warehouse/models.py
+++ b/archaeological_warehouse/models.py
@@ -54,7 +54,10 @@ class Warehouse(Address, DashboardFormItem, OwnPerms,
BASE_SEARCH_VECTORS = ['name', 'warehouse_type__label', "external_id",
"town", "comment"]
- EXTRA_REQUEST_KEYS = {}
+ EXTRA_REQUEST_KEYS = {
+ # used by dynamic_table_documents
+ "person_in_charge__pk": "person_in_charge__pk",
+ }
# alternative names of fields for searches
ALT_NAMES = {
'name': SearchAltName(
diff --git a/ishtar_common/templates/ishtar/sheet_person.html b/ishtar_common/templates/ishtar/sheet_person.html
index 308739619..a32229814 100644
--- a/ishtar_common/templates/ishtar/sheet_person.html
+++ b/ishtar_common/templates/ishtar/sheet_person.html
@@ -94,6 +94,16 @@
{% dynamic_table_document colla 'operations' 'collaborators__pk' item.pk '' output %}
{% endif %}
+{% trans "Operations associées en tant que rapporteur CIRA" as cira %}
+{% if item.cira_rapporteur.count %}
+{% dynamic_table_document cira 'operations' 'cira_rapporteur__pk' item.pk '' output %}
+{% endif %}
+
+{% trans "Associated archaeological sites as collaborator" as colla %}
+{% if item.site_collaborator.count %}
+{% dynamic_table_document colla 'sites' 'collaborators__pk' item.pk '' output %}
+{% endif %}
+
{% trans "In charge of archaeological files" as af %}
{% if item.file_responsability.count %}
{% dynamic_table_document af 'files' 'in_charge__pk' item.pk '' output %}
@@ -109,6 +119,43 @@
{% dynamic_table_document af 'files' 'responsible_town_planning_service__pk' item.pk '' output %}
{% endif %}
+{% comment %} to be tested.........
+{% trans "In charge of administrative acts" as admin_act %}
+{% if item.adminact_operation_in_charge.count %}
+{% dynamic_table_document admin_act 'admin_acts' 'in_charge__pk' item.pk '' output %}
+{% endif %}
+
+{% trans "Scientist of administrative acts" as admin_act %}
+{% if item.adminact_scientist.count %}
+{% dynamic_table_document admin_act 'admin_acts' 'scientist__pk' item.pk '' output %}
+{% endif %}
+
+{% trans "Signatory of administrative acts" as admin_act %}
+{% if item.signatory.count %}
+{% dynamic_table_document admin_act 'admin_acts' 'signatory__pk' item.pk '' output %}
+{% endif %}
+{% endcomment %}
+
+{% trans "In charge of treatments" as tr %}
+{% if item.treatments.count %}
+{% dynamic_table_document tr 'base_treatments' 'person__pk' item.pk '' output %}
+{% endif %}
+
+{% trans "In charge of treatment files" as tr %}
+{% if item.treatmentfile_responsability.count %}
+{% dynamic_table_document tr 'treatment_files' 'in_charge__pk' item.pk '' output %}
+{% endif %}
+
+{% trans "Applicant of treatment files" as tr %}
+{% if item.treatmentfile_applicant.count %}
+{% dynamic_table_document tr 'treatment_files' 'applicant__pk' item.pk '' output %}
+{% endif %}
+
+{% trans "In charge of warehouses" as wh %}
+{% if item.warehouse_in_charge.count %}
+{% dynamic_table_document wh 'warehouses' 'person_in_charge__pk' item.pk '' output %}
+{% endif %}
+
{% if item.docs_q.count %}
{% trans "Documents" as docs %}
{% dynamic_table_document docs 'documents' 'authors__person__pk' item.pk '' output %}
diff --git a/ishtar_common/templatetags/window_tables.py b/ishtar_common/templatetags/window_tables.py
index ce767e1ac..879349d02 100644
--- a/ishtar_common/templatetags/window_tables.py
+++ b/ishtar_common/templatetags/window_tables.py
@@ -14,12 +14,13 @@ from ishtar_common.widgets import DataTable
from ishtar_common.models import Document
from archaeological_files.models import File
-from archaeological_operations.models import Operation, ArchaeologicalSite
+from archaeological_operations.models import Operation, ArchaeologicalSite, \
+ AdministrativeAct
from archaeological_context_records.models import ContextRecord, \
RecordRelationView, RecordRelations as CRRecordRelations
from archaeological_finds.models import Find, FindUpstreamTreatments, \
- FindDownstreamTreatments, FindTreatments
-from archaeological_warehouse.models import Container
+ FindDownstreamTreatments, FindTreatments, TreatmentFile, Treatment
+from archaeological_warehouse.models import Container, Warehouse
register = template.Library()
@@ -32,6 +33,8 @@ def table_document(caption, data):
ASSOCIATED_MODELS = {}
ASSOCIATED_MODELS['files'] = (File, 'get-file', '')
ASSOCIATED_MODELS['operations'] = (Operation, 'get-operation', '')
+ASSOCIATED_MODELS['admin_acts'] = (AdministrativeAct,
+ 'get-administrativeact', '')
ASSOCIATED_MODELS['context_records'] = (ContextRecord, 'get-contextrecord',
'get-contextrecord-full')
ASSOCIATED_MODELS['context_records_for_ope'] = (
@@ -54,8 +57,11 @@ ASSOCIATED_MODELS['finds_downstreamtreatments'] = (
FindDownstreamTreatments, 'get-downstreamtreatment', '')
ASSOCIATED_MODELS['treatments'] = (
FindTreatments, 'get-treatment', '')
-ASSOCIATED_MODELS['containers'] = (
- Container, 'get-container', '')
+ASSOCIATED_MODELS['base_treatments'] = (
+ Treatment, 'get-treatment', '')
+ASSOCIATED_MODELS['treatment_files'] = (TreatmentFile, 'get-treatmentfile', '')
+ASSOCIATED_MODELS['containers'] = (Container, 'get-container', '')
+ASSOCIATED_MODELS['warehouses'] = (Warehouse, 'get-warehouse', '')
ASSOCIATED_MODELS['documents'] = (Document, 'get-document', '')