From 3232a862a9f68751ba17d7f850ce05f5f6a065c5 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 30 Nov 2016 17:49:39 +0100 Subject: Treatment searches and sheet --- archaeological_finds/models.py | 4 +-- .../templates/ishtar/sheet_treatment.html | 34 ++++++++++++++++++++++ .../templates/ishtar/sheet_treatment_pdf.html | 18 ++++++++++++ .../templates/ishtar/sheet_treatment_window.html | 3 ++ archaeological_finds/urls.py | 4 +++ archaeological_finds/views.py | 4 +++ 6 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 archaeological_finds/templates/ishtar/sheet_treatment.html create mode 100644 archaeological_finds/templates/ishtar/sheet_treatment_pdf.html create mode 100644 archaeological_finds/templates/ishtar/sheet_treatment_window.html (limited to 'archaeological_finds') diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py index a886485b5..2957c656d 100644 --- a/archaeological_finds/models.py +++ b/archaeological_finds/models.py @@ -807,8 +807,8 @@ class Treatment(BaseHistorizedItem, OwnPerms): help_text=_( u"Location where the treatment is done. Target warehouse for " u"a move.")) - other_location = models.CharField(_(u"Other location"), max_length=200, - blank=True, null=True) + other_location = models.CharField(_(u"Location (not referenced)"), + max_length=200, blank=True, null=True) person = models.ForeignKey( Person, verbose_name=_(u"Doer"), blank=True, null=True, on_delete=models.SET_NULL, related_name='treatments') diff --git a/archaeological_finds/templates/ishtar/sheet_treatment.html b/archaeological_finds/templates/ishtar/sheet_treatment.html new file mode 100644 index 000000000..20ea9e3c4 --- /dev/null +++ b/archaeological_finds/templates/ishtar/sheet_treatment.html @@ -0,0 +1,34 @@ +{% extends "ishtar/sheet.html" %} +{% load i18n window_field from_dict link_to_window window_tables window_header humanize %} +{% load url from future %} + +{% block head_title %}{% trans "Treatment" %}{% endblock %} +{% block content %} +{% window_nav item window_id 'show-treatment' %} + + +{% if item.description or item.comment %} +{% field "Description" item.description "
" "
" %} +{% field "Comment" item.comment "
" "
" %} +{% endif %} + +{% trans "Upstream finds" as finds %} +{% if item.upstream.count %} +{% dynamic_table_document finds 'finds_for_treatment' 'downstream_treatment' item.pk 'TABLE_COLS_FOR_OPE' output %} +{% endif %} + +{% trans "Downstream finds" as finds %} +{% if item.downstream.count %} +{% dynamic_table_document finds 'finds_for_treatment' 'upstream_treatment' item.pk 'TABLE_COLS_FOR_OPE' output %} +{% endif %} + + +{% endblock %} diff --git a/archaeological_finds/templates/ishtar/sheet_treatment_pdf.html b/archaeological_finds/templates/ishtar/sheet_treatment_pdf.html new file mode 100644 index 000000000..08df52e97 --- /dev/null +++ b/archaeological_finds/templates/ishtar/sheet_treatment_pdf.html @@ -0,0 +1,18 @@ +{% extends "ishtar/sheet_treatment.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_finds/templates/ishtar/sheet_treatment_window.html b/archaeological_finds/templates/ishtar/sheet_treatment_window.html new file mode 100644 index 000000000..fb0757d10 --- /dev/null +++ b/archaeological_finds/templates/ishtar/sheet_treatment_window.html @@ -0,0 +1,3 @@ +{% extends "ishtar/sheet_treatment.html" %} +{% block main_head %}{%endblock%} +{% block main_foot %}{%endblock%} diff --git a/archaeological_finds/urls.py b/archaeological_finds/urls.py index bbb123d09..220087d33 100644 --- a/archaeological_finds/urls.py +++ b/archaeological_finds/urls.py @@ -119,6 +119,10 @@ urlpatterns += patterns( name='get-own-find-for-ope', kwargs={'force_own': True}), url(r'get-find-for-ope/(?P.+)?$', 'get_find_for_ope', name='get-find-for-ope'), + url(r'get-find-for-treatment/own/(?P.+)?$', 'get_find_for_treatment', + name='get-own-find-for-treatment', kwargs={'force_own': True}), + url(r'get-find-for-treatment/(?P.+)?$', 'get_find_for_treatment', + name='get-find-for-treatment'), url(r'get-find-full/own/(?P.+)?$', 'get_find', name='get-own-find-full', kwargs={'full': True, 'force_own': True}), url(r'get-find-full/(?P.+)?$', 'get_find', diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py index f0c67c231..1f3213504 100644 --- a/archaeological_finds/views.py +++ b/archaeological_finds/views.py @@ -45,6 +45,10 @@ get_find = get_item(models.Find, 'get_find', 'find') get_find_for_ope = get_item(models.Find, 'get_find', 'find', own_table_cols=models.Find.TABLE_COLS_FOR_OPE) +get_find_for_treatment = get_item( + models.Find, 'get_find', 'find', + own_table_cols=models.Find.TABLE_COLS_FOR_OPE, base_request={}) + show_treatment = show_item(models.Treatment, 'treatment') get_treatment = get_item(models.Treatment, 'get_treatement', 'treatment') -- cgit v1.2.3