From a296bd385e704b1e76a774341f8ad126c892ccab Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 29 Dec 2015 18:26:54 +0100 Subject: Add a template for operation sources --- archaeological_operations/models.py | 2 ++ .../templates/ishtar/sheet_operationsource.html | 15 +++++++++++++++ .../templates/ishtar/sheet_operationsource_pdf.html | 18 ++++++++++++++++++ .../templates/ishtar/sheet_operationsource_window.html | 3 +++ archaeological_operations/urls.py | 5 ++++- archaeological_operations/views.py | 1 + 6 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 archaeological_operations/templates/ishtar/sheet_operationsource.html create mode 100644 archaeological_operations/templates/ishtar/sheet_operationsource_pdf.html create mode 100644 archaeological_operations/templates/ishtar/sheet_operationsource_window.html (limited to 'archaeological_operations') diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index d0059da9e..795c1a805 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -134,6 +134,7 @@ QUALITY = (('ND', _(u"Not documented")), class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, DashboardFormItem): QUALITY_DICT = dict(QUALITY) + SHOW_URL = 'show-operation' TABLE_COLS = ['year_index', 'operation_type', 'remains', 'towns', 'start_date', 'excavation_end_date'] if FILES_AVAILABLE: @@ -522,6 +523,7 @@ class OperationSource(Source): null=True) TABLE_COLS = ['operation.year', 'operation.operation_code'] + \ Source.TABLE_COLS + SHOW_URL = 'show-operationsource' @property def owner(self): diff --git a/archaeological_operations/templates/ishtar/sheet_operationsource.html b/archaeological_operations/templates/ishtar/sheet_operationsource.html new file mode 100644 index 000000000..5e2a39826 --- /dev/null +++ b/archaeological_operations/templates/ishtar/sheet_operationsource.html @@ -0,0 +1,15 @@ +{% extends "ishtar/sheet_source.html" %} +{% load i18n window_field link_to_window %} + +{% block head_sheet %} +{{block.super}} +

{% trans "Operation source"%}

+{% endblock %} + +{% block export %} +
{%trans "Export as:"%} {%trans "OpenOffice.org file"%}, {%trans "PDF file"%}
+{% endblock %} + +{% block related %} +{% field "Related operation" item.owner '' item.owner|link_to_window %} +{% endblock %} diff --git a/archaeological_operations/templates/ishtar/sheet_operationsource_pdf.html b/archaeological_operations/templates/ishtar/sheet_operationsource_pdf.html new file mode 100644 index 000000000..32362d4c2 --- /dev/null +++ b/archaeological_operations/templates/ishtar/sheet_operationsource_pdf.html @@ -0,0 +1,18 @@ +{% extends "ishtar/sheet_operationsource.html" %} +{% block header %} + +{% endblock %} +{% block main_head %} +{{ block.super }} +
+Ishtar – {{APP_NAME}} – {{item}} +
+{% endblock %} +{%block head_sheet%}{%endblock%} +{%block main_foot%} +
+– – +
+ + +{%endblock%} diff --git a/archaeological_operations/templates/ishtar/sheet_operationsource_window.html b/archaeological_operations/templates/ishtar/sheet_operationsource_window.html new file mode 100644 index 000000000..8cd2c7fa1 --- /dev/null +++ b/archaeological_operations/templates/ishtar/sheet_operationsource_window.html @@ -0,0 +1,3 @@ +{% extends "ishtar/sheet_operationsource.html" %} +{% block main_head %}{%endblock%} +{% block main_foot %}{%endblock%} diff --git a/archaeological_operations/urls.py b/archaeological_operations/urls.py index 68ac0bad0..76723deab 100644 --- a/archaeological_operations/urls.py +++ b/archaeological_operations/urls.py @@ -21,6 +21,7 @@ from django.conf.urls.defaults import * from ishtar_common.wizards import check_rights import views +import models # be carreful: each check_rights must be relevant with ishtar_menu @@ -104,7 +105,7 @@ urlpatterns += patterns( url(r'revert-operation/(?P.+)/(?P.+)$', 'revert_operation', name='revert-operation'), url(r'show-operation(?:/(?P.+))?/(?P.+)?$', - 'show_operation', name='show-operation'), + 'show_operation', name=models.Operation.SHOW_URL), url(r'show-historized-operation/(?P.+)?/(?P.+)?$', 'show_operation', name='show-historized-operation'), url(r'get-administrativeactop/(?P.+)?$', @@ -125,6 +126,8 @@ urlpatterns += patterns( url(r'generatedoc-administrativeactop/(?P.+)?/(?P.+)?$', 'generatedoc_administrativeactop', name='generatedoc-administrativeactop'), + url(r'show-operationsource(?:/(?P.+))?/(?P.+)?$', + 'show_operationsource', name=models.OperationSource.SHOW_URL), url(r'get-operationsource/(?P.+)?$', 'get_operationsource', name='get-operationsource'), url(r'dashboard_operation/$', 'dashboard_operation', diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py index 8d15c80ee..e8f458bc9 100644 --- a/archaeological_operations/views.py +++ b/archaeological_operations/views.py @@ -151,6 +151,7 @@ get_operation = get_item( show_operation = show_item(models.Operation, 'operation') revert_operation = revert_item(models.Operation) +show_operationsource = show_item(models.OperationSource, 'operationsource') get_operationsource = get_item( models.OperationSource, 'get_operationsource', 'operationsource', -- cgit v1.2.3