diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2015-12-29 18:26:54 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-12-29 18:28:18 +0100 |
commit | a296bd385e704b1e76a774341f8ad126c892ccab (patch) | |
tree | 648da5accc2a93a9ff5c0c80dd1ddc09f6bc708f /archaeological_operations | |
parent | 80726189acaa2ce5fa604dd589aad7d01c099d4f (diff) | |
download | Ishtar-a296bd385e704b1e76a774341f8ad126c892ccab.tar.bz2 Ishtar-a296bd385e704b1e76a774341f8ad126c892ccab.zip |
Add a template for operation sources
Diffstat (limited to 'archaeological_operations')
6 files changed, 43 insertions, 1 deletions
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}} +<h1>{% trans "Operation source"%}</h1> +{% endblock %} + +{% block export %} +<div class='tool'>{%trans "Export as:"%} <a href='{% url show-operationsource item.pk "odt" %}'>{%trans "OpenOffice.org file"%}</a>, <a href='{% url show-operationsource item.pk "pdf" %}'>{%trans "PDF file"%}</a></div> +{% 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 %} +<link rel="stylesheet" href="{{STATIC_URL}}/media/style_basic.css" /> +{% endblock %} +{% block main_head %} +{{ block.super }} +<div id="pdfheader"> +Ishtar – {{APP_NAME}} – {{item}} +</div> +{% endblock %} +{%block head_sheet%}{%endblock%} +{%block main_foot%} +<div id="pdffooter"> +– <pdf:pagenumber/> – +</div> +</body> +</html> +{%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<pk>.+)/(?P<date>.+)$', 'revert_operation', name='revert-operation'), url(r'show-operation(?:/(?P<pk>.+))?/(?P<type>.+)?$', - 'show_operation', name='show-operation'), + 'show_operation', name=models.Operation.SHOW_URL), url(r'show-historized-operation/(?P<pk>.+)?/(?P<date>.+)?$', 'show_operation', name='show-historized-operation'), url(r'get-administrativeactop/(?P<type>.+)?$', @@ -125,6 +126,8 @@ urlpatterns += patterns( url(r'generatedoc-administrativeactop/(?P<pk>.+)?/(?P<template_pk>.+)?$', 'generatedoc_administrativeactop', name='generatedoc-administrativeactop'), + url(r'show-operationsource(?:/(?P<pk>.+))?/(?P<type>.+)?$', + 'show_operationsource', name=models.OperationSource.SHOW_URL), url(r'get-operationsource/(?P<type>.+)?$', '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', |