From b8d84f2e1014cd09d7820fbb0650d5d089fe3919 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 29 Dec 2015 19:17:06 +0100 Subject: Add sheets for context record source and find source --- archaeological_context_records/models.py | 3 +++ .../templates/ishtar/sheet_contextrecordsource.html | 11 +++++++++++ .../ishtar/sheet_contextrecordsource_pdf.html | 18 ++++++++++++++++++ .../ishtar/sheet_contextrecordsource_window.html | 3 +++ archaeological_context_records/urls.py | 5 ++++- archaeological_context_records/views.py | 4 ++++ 6 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 archaeological_context_records/templates/ishtar/sheet_contextrecordsource.html create mode 100644 archaeological_context_records/templates/ishtar/sheet_contextrecordsource_pdf.html create mode 100644 archaeological_context_records/templates/ishtar/sheet_contextrecordsource_window.html (limited to 'archaeological_context_records') diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 6fc950f52..52d976cfd 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -106,6 +106,7 @@ class IdentificationType(GeneralType): class ContextRecord(BaseHistorizedItem, OwnPerms, ShortMenuItem): + SHOW_URL = 'show-contextrecord' TABLE_COLS = ['parcel.town', 'operation.year', 'operation.operation_code', 'label', 'unit'] @@ -311,6 +312,8 @@ post_delete.connect(post_delete_record_relation, sender=RecordRelations) class ContextRecordSource(Source): + SHOW_URL = 'show-contextrecordsource' + class Meta: verbose_name = _(u"Context record documentation") verbose_name_plural = _(u"Context record documentations") diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecordsource.html b/archaeological_context_records/templates/ishtar/sheet_contextrecordsource.html new file mode 100644 index 000000000..17d09d843 --- /dev/null +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecordsource.html @@ -0,0 +1,11 @@ +{% extends "ishtar/sheet_source.html" %} +{% load i18n window_field link_to_window %} + +{% block head_sheet %} +{{block.super}} +

{% trans "Context record source"%}

+{% endblock %} + +{% block related %} +{% field "Related context record" item.owner '' item.owner|link_to_window %} +{% endblock %} diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecordsource_pdf.html b/archaeological_context_records/templates/ishtar/sheet_contextrecordsource_pdf.html new file mode 100644 index 000000000..8e6b9bb85 --- /dev/null +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecordsource_pdf.html @@ -0,0 +1,18 @@ +{% extends "ishtar/sheet_contextrecordsource.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_context_records/templates/ishtar/sheet_contextrecordsource_window.html b/archaeological_context_records/templates/ishtar/sheet_contextrecordsource_window.html new file mode 100644 index 000000000..21dd20758 --- /dev/null +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecordsource_window.html @@ -0,0 +1,3 @@ +{% extends "ishtar/sheet_contextrecordsource.html" %} +{% block main_head %}{%endblock%} +{% block main_foot %}{%endblock%} diff --git a/archaeological_context_records/urls.py b/archaeological_context_records/urls.py index 6ffc2f194..da6d80a98 100644 --- a/archaeological_context_records/urls.py +++ b/archaeological_context_records/urls.py @@ -19,6 +19,7 @@ from django.conf.urls.defaults import * +from archaeological_context_records import models from ishtar_common.wizards import check_rights import views @@ -59,7 +60,7 @@ urlpatterns = patterns( urlpatterns += patterns( 'archaeological_context_records.views', url(r'show-contextrecord(?:/(?P.+))?/(?P.+)?$', - 'show_contextrecord', name='show-contextrecord'), + 'show_contextrecord', name=models.ContextRecord.SHOW_URL), url(r'show-historized-contextrecord/(?P.+)?/(?P.+)?$', 'show_contextrecord', name='show-historized-contextrecord'), url(r'revert-contextrecord/(?P.+)/(?P.+)$', @@ -80,6 +81,8 @@ urlpatterns += patterns( url(r'get-contextrecord-full/(?P.+)?$', 'get_contextrecord', name='get-contextrecord-full', kwargs={'full': True}), + url(r'show-contextrecordsource(?:/(?P.+))?/(?P.+)?$', + 'show_contextrecordsource', name=models.ContextRecordSource.SHOW_URL), url(r'get-contexrecordsource/(?P.+)?$', 'get_contextrecordsource', name='get-contextrecordsource'), ) diff --git a/archaeological_context_records/views.py b/archaeological_context_records/views.py index 41d290a3f..ccd0eaf01 100644 --- a/archaeological_context_records/views.py +++ b/archaeological_context_records/views.py @@ -51,6 +51,10 @@ get_contextrecord_for_ope = get_item( 'get_contextrecord', 'contextrecord', extra_request_keys=contextrecord_extra_keys, own_table_cols=models.ContextRecord.TABLE_COLS_FOR_OPE) + +show_contextrecordsource = show_item(models.ContextRecordSource, + 'contextrecordsource') + get_contextrecordsource = get_item( models.ContextRecordSource, 'get_contextrecordsource', 'contextrecordsource', -- cgit v1.2.3