From 0e8b89cc3db520537e96157c178a4985c644b7ce Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 7 Dec 2015 19:33:36 +0100 Subject: Person sheet: better management of related operations and files --- ishtar_common/templates/ishtar/sheet_person.html | 67 +++++------------------- ishtar_common/templatetags/window_tables.py | 9 +++- 2 files changed, 22 insertions(+), 54 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/templates/ishtar/sheet_person.html b/ishtar_common/templates/ishtar/sheet_person.html index 38bc39c58..126afe83a 100644 --- a/ishtar_common/templates/ishtar/sheet_person.html +++ b/ishtar_common/templates/ishtar/sheet_person.html @@ -1,5 +1,5 @@ {% extends "ishtar/sheet.html" %} -{% load i18n window_field %} +{% load i18n window_field window_tables %} {% block head_sheet %} {{block.super}} @@ -33,59 +33,20 @@ {% endif %} - - - - - - - - - - - - - {% for operation in item.operation_scientific_responsability.all %} - - - - - - - - - - - {% empty %} - - {% endfor %} -
{%trans "Associated operations"%}
{% trans "Year" %}{% trans "Ref." %}Code Patriarche{% trans "Type" %}{% trans "In charge" %}{% trans "Start date" %}{% trans "Excavation end date" %} 
{{operation.year|default:""}}{{operation.operation_code|default:""}}{{operation.code_patriarche|default:""}}{{operation.operation_type}}{{operation.in_charge|default:""}}{{operation.start_date|default:""}}{{operation.excavation_end_date|default:""}}
{% trans "No operation associated to this person" %}
+{% trans "Associated operations as scientist" as ao %} +{% if item.operation_scientist_responsability.count %} +{% dynamic_table_document ao 'operations' 'operation_scientist_responsability' item.pk %} +{% endif %} +{% trans "Associated operations as responsible" as ao %} +{% if item.operation_responsability.count %} +{% dynamic_table_document ao 'operations' 'operation_responsability' item.pk %} +{% endif %} - - - - - - - - - - - - {% for file in item.file_responsability.all %} - - - - - - - - - - {% empty %} - - {% endfor %} -
{%trans "Associated archaelogical files"%}
{% trans "Ref." %}{% trans "Year" %}{% trans "Internal ref." %}{% trans "File type" %}Type de saisine{% trans "Towns" %} 
{{file.numeric_reference}}{{file.year}}{{file.internal_reference}}{{file.file_type}}{{file.saisine_type}}{{file.town_list}}
{% trans "No archaelogical file associated to this person" %}
+ +{% trans "Associated archaelogical files" as af %} +{% if item.file_responsability.count %} +{% dynamic_table_document af 'files' 'file_responsability' item.pk %} +{% endif %} diff --git a/ishtar_common/templatetags/window_tables.py b/ishtar_common/templatetags/window_tables.py index 32a3076c5..a1aa735a7 100644 --- a/ishtar_common/templatetags/window_tables.py +++ b/ishtar_common/templatetags/window_tables.py @@ -17,9 +17,16 @@ def table_document(caption, data): ASSOCIATED_MODELS = {} try: - from archaeological_operations.models import OperationSource + from archaeological_files.models import File + ASSOCIATED_MODELS['files'] = (File, 'get-file', '') +except: + pass + +try: + from archaeological_operations.models import OperationSource, Operation ASSOCIATED_MODELS['operation_docs'] = (OperationSource, 'get-operationsource', '') + ASSOCIATED_MODELS['operations'] = (Operation, 'get-operation', '') except: pass -- cgit v1.2.3
{%trans "Documents"%}