From c693630090f670ca33981dcdf0b135fdd7432972 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 4 Apr 2013 12:48:06 +0200 Subject: Operations: search operations by dates (refs #1187) --- ishtar_common/views.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ishtar_common/views.py') diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 4a1a656d9..83833e517 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -173,7 +173,7 @@ HIERARCHIC_LEVELS = 5 HIERARCHIC_FIELDS = ['period', 'unit', 'material_type'] PRIVATE_FIELDS = ('id', 'history_modifier', 'order') def get_item(model, func_name, default_name, extra_request_keys=[], - base_request={}, bool_fields=[]): + base_request={}, bool_fields=[], dated_fields=[]): """ Generic treatment of tables """ @@ -213,7 +213,18 @@ def get_item(model, func_name, default_name, extra_request_keys=[], dct.pop(k) else: dct[k] = dct[k] == u"2" and True or False - + for k in dated_fields: + if k in dct: + if not dct[k]: + dct.pop(k) + try: + items = dct[k].split('/') + assert len(items) == 3 + dct[k] = datetime.date(*map(lambda x: int(x), + reversed(items)) + ).strftime('%Y-%m-%d') + except AssertionError: + dct.pop(k) # manage hierarchic conditions or_reqs = [] for req in dct.copy(): -- cgit v1.2.3 From 157259f4a9a030367f123ae1b2802c529b151197 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 4 Apr 2013 14:58:05 +0200 Subject: Forms (operations, context records, files): add search by parcel (refs #575) --- archaeological_context_records/forms.py | 16 +++++++++--- archaeological_context_records/views.py | 7 ++++-- archaeological_files/forms.py | 17 ++++++++++--- archaeological_files/views.py | 8 ++++-- archaeological_finds/forms.py | 4 +-- archaeological_operations/forms.py | 24 +++++++++++++++--- archaeological_operations/views.py | 14 ++++++++++- archaeological_operations/widgets.py | 43 +++++++++++++++++++++++++++++++++ archaeological_warehouse/forms.py | 5 ++-- ishtar_common/forms.py | 6 ++++- ishtar_common/forms_common.py | 4 +-- ishtar_common/static/media/style.css | 3 +++ ishtar_common/views.py | 2 +- ishtar_common/widgets.py | 6 ++--- 14 files changed, 132 insertions(+), 27 deletions(-) create mode 100644 archaeological_operations/widgets.py (limited to 'ishtar_common/views.py') diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py index 41e4a1e20..fce5193d6 100644 --- a/archaeological_context_records/forms.py +++ b/archaeological_context_records/forms.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2010-2012 Étienne Loks +# Copyright (C) 2010-2013 Étienne Loks # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -36,16 +36,17 @@ import models from ishtar_common import widgets from ishtar_common.forms import FinalForm, FinalForm, FormSet, \ - formset_factory, get_now, reverse_lazy, get_form_selection + formset_factory, get_now, reverse_lazy, get_form_selection, TableSelect from ishtar_common.forms_common import get_town_field, SourceForm, \ SourceSelect, AuthorFormset -from archaeological_operations.forms import OperationSelect +from archaeological_operations.forms import OperationSelect, ParcelField -class RecordSelect(forms.Form): +class RecordSelect(TableSelect): parcel__town = get_town_field() operation__year = forms.IntegerField(label=_(u"Year")) datings__period = forms.ChoiceField(label=_(u"Period"), choices=[]) unit = forms.ChoiceField(label=_(u"Unit type"), choices=[]) + parcel = ParcelField(label=_("Parcel (section/number)")) def __init__(self, *args, **kwargs): super(RecordSelect, self).__init__(*args, **kwargs) self.fields['datings__period'].choices = Period.get_types() @@ -53,6 +54,13 @@ class RecordSelect(forms.Form): self.fields['unit'].choices = models.Unit.get_types() self.fields['unit'].help_text = models.Unit.get_help() + def get_input_ids(self): + ids = super(RecordSelect, self).get_input_ids() + ids.pop(ids.index('parcel')) + ids.append('parcel_0') + ids.append('parcel_1') + return ids + class RecordFormSelection(forms.Form): form_label = _("Context record search") associated_models = {'pk':models.ContextRecord} diff --git a/archaeological_context_records/views.py b/archaeological_context_records/views.py index bd18ffa49..c59446bcf 100644 --- a/archaeological_context_records/views.py +++ b/archaeological_context_records/views.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2010-2012 Étienne Loks +# Copyright (C) 2010-2013 Étienne Loks # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -30,7 +30,10 @@ get_contextrecord = get_item(models.ContextRecord, 'get_contextrecord', 'contextrecord', extra_request_keys={'parcel__town':'parcel__town__pk', 'operation__year':'operation__year__contains', - 'datings__period':'datings__period__pk'},) + 'datings__period':'datings__period__pk', + 'parcel_0':'operation__parcels__section', + 'parcel_1':'operation__parcels__parcel_number', + },) get_contextrecordsource = get_item(models.ContextRecordSource, 'get_contextrecordsource', 'contextrecordsource', extra_request_keys={ diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py index 564d0c6fc..ea12c984c 100644 --- a/archaeological_files/forms.py +++ b/archaeological_files/forms.py @@ -36,13 +36,14 @@ from ishtar_common.models import Person, PersonType, Town, Organization, \ from archaeological_operations.models import ActType, AdministrativeAct import models from ishtar_common.forms import FinalForm, FormSet, ClosingDateFormSelection, \ - formset_factory, get_now, reverse_lazy + formset_factory, get_now, reverse_lazy, TableSelect from ishtar_common.forms_common import get_town_field, get_person_field from archaeological_operations.forms import AdministrativeActOpeForm, \ - AdministrativeActOpeFormSelection, FinalAdministrativeActDeleteForm + AdministrativeActOpeFormSelection, FinalAdministrativeActDeleteForm, \ + ParcelField from ishtar_common import widgets -class FileSelect(forms.Form): +class FileSelect(TableSelect): towns = get_town_field() in_charge = get_person_field(label=_(u"Person in charge"), person_type='sra_agent') @@ -50,12 +51,20 @@ class FileSelect(forms.Form): choices=models.FileType.get_types()) saisine_type = forms.ChoiceField(label=_("Saisine type"), choices=[]) year = forms.IntegerField(label=_("Year")) + parcel = ParcelField(label=_("Parcel (section/number)")) def __init__(self, *args, **kwargs): super(FileSelect, self).__init__(*args, **kwargs) self.fields['saisine_type'].choices = models.SaisineType.get_types() self.fields['saisine_type'].help_text = models.SaisineType.get_help() + def get_input_ids(self): + ids = super(FileSelect, self).get_input_ids() + ids.pop(ids.index('parcel')) + ids.append('parcel_0') + ids.append('parcel_1') + return ids + class FileFormSelection(forms.Form): form_label = _("Archaeological file search") associated_models = {'pk':models.File} @@ -170,7 +179,7 @@ class FinalFileDeleteForm(FinalForm): confirm_msg = " " confirm_end_msg = _(u"Would you like to delete this archaelogical file ?") -class AdministrativeActFileSelect(forms.Form): +class AdministrativeActFileSelect(TableSelect): associated_file__towns = get_town_field() act_type = forms.ChoiceField(label=_("Act type"), choices=[]) diff --git a/archaeological_files/views.py b/archaeological_files/views.py index 3ef8c0f28..2b5003911 100644 --- a/archaeological_files/views.py +++ b/archaeological_files/views.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2010-2012 Étienne Loks +# Copyright (C) 2010-2013 Étienne Loks # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -60,7 +60,11 @@ def autocomplete_file(request): for file in files]) return HttpResponse(data, mimetype='text/plain') -get_file = get_item(models.File, 'get_file', 'file') +get_file = get_item(models.File, 'get_file', 'file', + extra_request_keys={'parcel_0':'operations__parcels__section', + 'parcel_1':'operations__parcels__parcel_number', + }, + ) show_file = show_item(models.File, 'file') revert_file = revert_item(models.File) diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index c5480d8a8..feaad0e23 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -39,7 +39,7 @@ import models from ishtar_common import widgets from ishtar_common.forms import FinalForm, FormSet, FloatField, \ - formset_factory, get_now, get_form_selection, reverse_lazy + formset_factory, get_now, get_form_selection, reverse_lazy, TableSelect from ishtar_common.forms_common import get_town_field, \ SourceForm, SourceSelect, SourceDeletionForm, AuthorFormset from archaeological_context_records.forms import RecordFormSelection @@ -81,7 +81,7 @@ class DateForm(forms.Form): self.fields['dating__dating_type'].choices = DatingType.get_types() self.fields['dating__dating_type'].help_text = DatingType.get_help() -class FindSelect(forms.Form): +class FindSelect(TableSelect): base_finds__context_record__parcel__town = get_town_field() base_finds__context_record__operation__year = forms.IntegerField( label=_(u"Year")) diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 5501857ba..547daf828 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -35,13 +35,23 @@ from django.utils.translation import ugettext_lazy as _ from ishtar_common.models import valid_id, PersonType, Person, Town from archaeological_files.models import File import models +from widgets import ParcelWidget from ishtar_common import widgets from ishtar_common.forms import FinalForm, FormSet, ClosingDateFormSelection, \ - formset_factory, get_now, reverse_lazy, get_form_selection + formset_factory, get_now, reverse_lazy, get_form_selection, TableSelect from ishtar_common.forms_common import TownForm, TownFormSet, TownFormset, \ AuthorFormset, SourceForm, SourceSelect, \ SourceDeletionForm, get_town_field +class ParcelField(forms.MultiValueField): + def __init__(self, *args, **kwargs): + if 'widget' not in kwargs: + self.widget = ParcelWidget() + return super(ParcelField, self).__init__(*args, **kwargs) + + def compress(data_list): + return u"-".join(data_list) + class ParcelForm(forms.Form): form_label = _("Parcels") base_model = 'parcel' @@ -93,7 +103,7 @@ ParcelFormSet = formset_factory(ParcelForm, can_delete=True, formset=ParcelFormSet) ParcelFormSet.form_label = _(u"Parcels") -class OperationSelect(forms.Form): +class OperationSelect(TableSelect): common_name = forms.CharField(label=_(u"Name"), max_length=30) if settings.COUNTRY == 'fr': code_patriarche = forms.IntegerField( @@ -120,6 +130,7 @@ class OperationSelect(forms.Form): widget=widgets.JQueryDate) end_after = forms.DateField(label=_(u"Ended after"), widget=widgets.JQueryDate) + parcel = ParcelField(label=_("Parcel (section/number)")) end_date = forms.NullBooleanField(label=_(u"Is open?")) def __init__(self, *args, **kwargs): @@ -127,6 +138,13 @@ class OperationSelect(forms.Form): self.fields['operation_type'].choices = models.OperationType.get_types() self.fields['operation_type'].help_text = models.OperationType.get_help() + def get_input_ids(self): + ids = super(OperationSelect, self).get_input_ids() + ids.pop(ids.index('parcel')) + ids.append('parcel_0') + ids.append('parcel_1') + return ids + class OperationFormSelection(forms.Form): form_label = _(u"Operation search") associated_models = {'pk':models.Operation} @@ -425,7 +443,7 @@ OperationSourceFormSelection = get_form_selection( # Administrative act management for operations # ################################################ -class AdministrativeActOpeSelect(forms.Form): +class AdministrativeActOpeSelect(TableSelect): operation__towns = get_town_field() act_type = forms.ChoiceField(label=_("Act type"), choices=[]) diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py index 4650e4764..84f208bf3 100644 --- a/archaeological_operations/views.py +++ b/archaeological_operations/views.py @@ -92,6 +92,14 @@ def get_available_operation_code(request, year=None): data = json.dumps({'id':models.Operation.get_available_operation_code(year)}) return HttpResponse(data, mimetype='text/plain') +def get_parcel_parser(key_section, key_number): + def func(dct): + print dct + section, number = dct.get(key_section), dct.get(key_number) + if not section or not number: + return {} + return {key_section:section, key_number:number} + get_operation = get_item(models.Operation, 'get_operation', 'operation', bool_fields = ['end_date__isnull'], dated_fields = ['start_date__lte', 'start_date__gte', @@ -102,7 +110,11 @@ get_operation = get_item(models.Operation, 'get_operation', 'operation', 'start_before':'start_date__lte', 'start_after':'start_date__gte', 'end_before':'excavation_end_date__lte', - 'end_after':'excavation_end_date__gte',}) + 'end_after':'excavation_end_date__gte', + 'parcel_0':'parcels__section', + 'parcel_1':'parcels__parcel_number', + }, + ) show_operation = show_item(models.Operation, 'operation') revert_operation = revert_item(models.Operation) diff --git a/archaeological_operations/widgets.py b/archaeological_operations/widgets.py new file mode 100644 index 000000000..0e84b2047 --- /dev/null +++ b/archaeological_operations/widgets.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2013 Étienne Loks + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +# See the file COPYING for details. + +from django import forms +from django.forms import widgets + +class ParcelWidget(widgets.MultiWidget): + def __init__(self, attrs=None): + if not attrs: + attrs = {'class':'widget-parcel'} + elif 'class' not in attrs: + attrs['class'] = 'widget-parcel' + else: + attrs['class'] += ' widget-parcel' + _widgets = ( + widgets.TextInput(attrs=attrs), + widgets.TextInput(attrs=attrs), + ) + super(ParcelWidget, self).__init__(_widgets, attrs) + + def decompress(self, value): + if value: + return value + return [None, None] + + def format_output(self, rendered_widgets): + return u' / '.join(rendered_widgets) diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py index 2e1bfcc05..69bb2cae3 100644 --- a/archaeological_warehouse/forms.py +++ b/archaeological_warehouse/forms.py @@ -27,7 +27,8 @@ from ishtar_common.models import Person, valid_id from archaeological_finds.models import TreatmentType import models from ishtar_common import widgets -from ishtar_common.forms import name_validator, reverse_lazy, get_form_selection +from ishtar_common.forms import name_validator, reverse_lazy, \ + get_form_selection, TableSelect from archaeological_finds.forms import FindMultipleFormSelection def get_warehouse_field(label=_(u"Warehouse"), required=True): @@ -109,7 +110,7 @@ class ContainerForm(forms.Form): new_item.save() return new_item -class ContainerSelect(forms.Form): +class ContainerSelect(TableSelect): location = get_warehouse_field() container_type = forms.ChoiceField(label=_(u"Container type"), choices=[]) reference = forms.CharField(label=_(u"Reference")) diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index d66d6d4cc..cb007442e 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2010-2011 Étienne Loks +# Copyright (C) 2010-2013 Étienne Loks # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -101,6 +101,10 @@ class FormSet(BaseFormSet): form.fields[DELETION_FIELD_NAME].label = '' form.fields[DELETION_FIELD_NAME].widget = widgets.DeleteWidget() +class TableSelect(forms.Form): + def get_input_ids(self): + return self.fields.keys() + def get_now(): format = formats.get_format('DATE_INPUT_FORMATS')[0] value = datetime.datetime.now().strftime(format) diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 34a930e36..52fcfc97a 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -37,7 +37,7 @@ from django.utils.translation import ugettext_lazy as _ import models import widgets -from forms import FinalForm, FormSet, reverse_lazy, name_validator +from forms import FinalForm, FormSet, reverse_lazy, name_validator, TableSelect def get_town_field(label=_(u"Town"), required=True): help_text = _(u"

Type name, department code and/or postal code of the " @@ -234,7 +234,7 @@ class SourceForm(forms.Form): super(SourceForm, self).__init__(*args, **kwargs) self.fields['source_type'].choices = models.SourceType.get_types() -class SourceSelect(forms.Form): +class SourceSelect(TableSelect): authors = forms.IntegerField( widget=widgets.JQueryAutoComplete("/" + settings.URL_PATH + \ 'autocomplete-author', associated_model=models.Author), diff --git a/ishtar_common/static/media/style.css b/ishtar_common/static/media/style.css index 2aa673b51..cad9a224a 100644 --- a/ishtar_common/static/media/style.css +++ b/ishtar_common/static/media/style.css @@ -528,3 +528,6 @@ a.remove{ border:1px solid; } +.widget-parcel{ + width:60px; +} diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 83833e517..54523996f 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -173,7 +173,7 @@ HIERARCHIC_LEVELS = 5 HIERARCHIC_FIELDS = ['period', 'unit', 'material_type'] PRIVATE_FIELDS = ('id', 'history_modifier', 'order') def get_item(model, func_name, default_name, extra_request_keys=[], - base_request={}, bool_fields=[], dated_fields=[]): + base_request={}, bool_fields=[], dated_fields=[]): """ Generic treatment of tables """ diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py index ecc48a1e8..1fd0b6ac0 100644 --- a/ishtar_common/widgets.py +++ b/ishtar_common/widgets.py @@ -219,8 +219,8 @@ class JQueryJqGrid(forms.RadioSelect): rendered += "\n

%s

\n" % unicode(_("Search and select an item")) extra_cols = [] col_names, col_idx = [], [] - for k in self.form.fields: - field = self.form.fields[k] + for k in self.form.get_input_ids(): + #field = self.form.fields[k] col_idx.append(u'"%s"' % k) for field_name in getattr(self.associated_model, self.table_cols): field = self.associated_model @@ -292,7 +292,7 @@ class JQueryJqGrid(forms.RadioSelect): } } var mygrid = jQuery("#grid_%(name)s"); - var url = "%(source)s?submited=1&" + data; + var url = "%(source)s?submited=1&" + data; mygrid.setGridParam({url:url}); mygrid.trigger("reloadGrid"); return false; -- cgit v1.2.3 From 6c225450c36c0fb58df61dd641f25fa78db2c7a5 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 4 Apr 2013 18:12:56 +0200 Subject: Rename and move sheets templates --- .../templates/ishtar/sheet_contextrecord.html | 135 +++++++++++++++ .../ishtar/sheet_contextrecord_window.html | 3 + .../templates/ishtar/sheet_file.html | 132 +++++++++++++++ .../templates/ishtar/sheet_file_pdf.html | 18 ++ .../templates/ishtar/sheet_file_window.html | 3 + .../templates/ishtar/sheet_operation.html | 183 +++++++++++++++++++++ .../templates/ishtar/sheet_operation_pdf.html | 18 ++ .../templates/ishtar/sheet_operation_window.html | 3 + ishtar_common/templates/ishtar/sheet.html | 30 ++++ ishtar_common/templates/sheet.html | 30 ---- ishtar_common/templates/sheet_contextrecord.html | 135 --------------- .../templates/sheet_contextrecord_window.html | 3 - ishtar_common/templates/sheet_file.html | 132 --------------- ishtar_common/templates/sheet_file_pdf.html | 18 -- ishtar_common/templates/sheet_file_window.html | 3 - ishtar_common/templates/sheet_operation.html | 183 --------------------- ishtar_common/templates/sheet_operation_pdf.html | 18 -- .../templates/sheet_operation_window.html | 3 - ishtar_common/views.py | 8 +- 19 files changed, 529 insertions(+), 529 deletions(-) create mode 100644 archaeological_context_records/templates/ishtar/sheet_contextrecord.html create mode 100644 archaeological_context_records/templates/ishtar/sheet_contextrecord_window.html create mode 100644 archaeological_files/templates/ishtar/sheet_file.html create mode 100644 archaeological_files/templates/ishtar/sheet_file_pdf.html create mode 100644 archaeological_files/templates/ishtar/sheet_file_window.html create mode 100644 archaeological_operations/templates/ishtar/sheet_operation.html create mode 100644 archaeological_operations/templates/ishtar/sheet_operation_pdf.html create mode 100644 archaeological_operations/templates/ishtar/sheet_operation_window.html create mode 100644 ishtar_common/templates/ishtar/sheet.html delete mode 100644 ishtar_common/templates/sheet.html delete mode 100644 ishtar_common/templates/sheet_contextrecord.html delete mode 100644 ishtar_common/templates/sheet_contextrecord_window.html delete mode 100644 ishtar_common/templates/sheet_file.html delete mode 100644 ishtar_common/templates/sheet_file_pdf.html delete mode 100644 ishtar_common/templates/sheet_file_window.html delete mode 100644 ishtar_common/templates/sheet_operation.html delete mode 100644 ishtar_common/templates/sheet_operation_pdf.html delete mode 100644 ishtar_common/templates/sheet_operation_window.html (limited to 'ishtar_common/views.py') diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html new file mode 100644 index 000000000..d8e06f022 --- /dev/null +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html @@ -0,0 +1,135 @@ +{% extends "ishtar/sheet.html" %} +{% load i18n %} +{% block content %} + + +

{% trans "Context Record"%}

+ +{% if item.operation.code_patriarche %} +

+{% else %} +

+

+{%endif%} +{{item.full_label}}

+{%if item.unit %} +

{{ item.unit }}

+{%endif%} +

{{ item.datings.all|join:", " }}

+

{{ item.parcel.town }}

+

{{ item.parcel.short_label }}

+ +{% if item.description or item.lenght or item.width or item.depth %} +

{% trans "Description"%}

+ +

{{ item.description }}

+{% if item.lenght %}

{{ item.length }}

{%endif%} +{% if item.width %}

{{ item.width }}

{%endif%} +{% if item.depth %}

{{ item.depth }}

{%endif%} +{% endif %} + +{% if item.activity or item.identification or item.interpretation %} +

{% trans "Interpretation"%}

+ +{% if item.activity %}

{{ item.activity }}

{%endif%} +{% if item.identification %}

{{ item.identification }}

{%endif%} +{% if item.interpretation %}

{{ item.interpretation }}

{%endif%} +{% endif %} + +{% if item.taq or item.taq_estimated or item.tpq or item.tpq_estimated %} +

{% trans "Datations"%}

+{% if item.taq %}

{{ item.taq }}

{%endif%} +{% if item.taq_estimated %}

{{ item.taq_estimated }}

{%endif%} +{% if item.tpq %}

{{ item.tpq }}

{%endif%} +{% if item.tpq_estimated %}

{{ item.tpq_estimated }}

{%endif%} +{%endif%} + +{% if item.operation %} +

{% trans "Operation resume"%}

+

{{ item.operation.year }}

+

{{ item.operation.operation_code }}

+{% if item.operation.code_patriarche %} +

+{{ item.operation.code_patriarche }}

+{% else %}

+{%endif%} +{#

{{ item.operation.internal_reference }}

#} +

+{{ item.operation.in_charge.full_label }}

+

+{% if item.operation.is_active %} +{%trans "Active file"%}

+{% else %} +{%trans "Closed operation"%}

+

{{ item.operation.closing.date }} +{%trans "by" %} {{ item.operation.closing.user }}

+{% endif %} +

{{ item.operation.operation_type }}

+

{{ item.operation.remains.all|join:", " }}

+

{{ item.operation.periods.all|join:", " }}

+{% if item.operation.comment %}

{{ item.operation.comment }}

{%endif%} +

{% trans "Localisation"%}

+

{{ item.operation.towns.all|join:", " }}

+

+{{ item.operation }}

+{# TODO: Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related operation #} +{% else %}

+{% endif %} + + + + + + + + {##} + + {% for doc in item.source.all %} + + + + + {##} + + {% empty %} + + {% endfor %} +
{%trans "Documents"%}
{% trans "Title" %}{% trans "Type" %}{% trans "Authors" %}{% trans "Localisation" %}
{{ doc.title }}{{doc.source_type}}{{ doc.authors.all|join:", " }}{{ doc.localisation }}
{% trans "No document associated to this context record" %}
+ + + + + + + + + + + + + + + {% for find in item.base_finds.all %} + + +{# Displayed as (Patriarche operation code)-(Record unit label)-(Finds label). #} +{# or displayed as (Year)-(index)-(Record unit label)-(Finds label). #} + +{# Displayed as (Patriarche operation code)-(Record unit label)-(material code)-(Finds label indexed by material type). #} +{# or displayed as (Year)-(index)-(Record unit label)-(material code)-(Finds label indexed by material type) #} + + + {# TODO .all|join:", " ? #} + + + + + + {#{%trans "Details"%}#} + + {% empty %} + + {% endfor %} +
{%trans "Finds"%}
{% trans "Find" %}{% trans "Material type" %}{% trans "Context record" %}{% trans "Periods" %}{% trans "Description" %}{% trans "Weight" %}{% trans "Numbers" %}{% trans "Parcel" %} 
{{ find.full_label }}{{ find.material_type_label }}{{find.context_record}}{{ find.get_last_find.dating}}{{ find.get_last_find.description }}{{ find.get_last_find.weight }}{{ find.get_last_find.item_number }}{{ item.context_record.parcel.short_label }}
{% trans "No find associated to this context record" %}
+ +{% endblock %} diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord_window.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord_window.html new file mode 100644 index 000000000..b485ebd47 --- /dev/null +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord_window.html @@ -0,0 +1,3 @@ +{% extends "ishtar/sheet_contextrecord.html" %} +{% block main_head %}{%endblock%} +{% block main_foot %}{%endblock%} diff --git a/archaeological_files/templates/ishtar/sheet_file.html b/archaeological_files/templates/ishtar/sheet_file.html new file mode 100644 index 000000000..1b58aa332 --- /dev/null +++ b/archaeological_files/templates/ishtar/sheet_file.html @@ -0,0 +1,132 @@ +{% extends "ishtar/sheet.html" %} +{% load i18n %} +{% block content %} +{% if previous or next %} +
+{%if previous%} +{%trans "Previous version"%} ({{previous}}) +{% endif %} +{% if previous and next %} - {% endif %} +{%if next%} +Rollback - +{%trans "Next version"%} ({{next}}) +{% endif %} +
+{% endif %} + +

{% trans "General"%}

+

{{ item.year }}

+

{{ item.numeric_reference }}

+ +

{{ item.internal_reference }}

+ +

{{ item.history_date }}

+{% if item.reception_date %}

{{ item.reception_date }}

{% endif %} +

{{ item.creation_date }}

+{% comment %} +{% if item.deadline_date and not item.acts %} +

{% item.deadline_date %}

+{% endif %} +{% endcomment %} + +

{{ item.in_charge.full_label }}

+

{% if item.is_active %}{%trans "Active file"%}

+{% else %}{%trans "Closed file"%}

+

{{ item.closing.date }} {%trans "by" %} {{ item.closing.user }}

+{% endif %} + +

{{ item.file_type }}

+ +{% if item.related_file %}

{{ item.related_file }}

{% endif %} +{% if item.comment %}

{{ item.comment }}

{%endif%} + +

{% trans "Localisation"%}

+

{{ item.towns.all|join:", " }}

+ +

{{ item.address }}

+{% if item.address_complement %}

{{ item.address_complement }}

{%endif%} +{% if item.postal_code %}

{{ item.postal_code }}

{%endif%} + +

{% if item.total_surface %} {{ item.total_surface }} m2 ({{ item.total_surface_ha }} ha){%endif%}

+ + + +{% if item.is_preventive %} +

{% trans "Preventive archaelogical file"%}

+

{{ item.total_developed_surface }} m2 ({{ item.total_developed_surface_ha }} ha)

+

{{ item.saisine_type }}

+{% if item.town_planning_service %}

{{ item.town_planning_service }}

{% endif %} +{% if item.permit_type %}

{{ item.permit_type }}

{% endif %} +{% if item.permit_reference %}

{{ item.permit_reference }}

{% endif %} +{% if item.general_contractor.attached_to %}

{{ item.general_contractor.attached_to }}

{% endif %} +{% if item.general_contractor %}

{{ item.general_contractor.full_label }}

{% endif %} +{% endif %} + + + + + + + + + + {% for act in item.administrative_act.all %} + + + + + + + {% empty %} + + {% endfor %} +
{%trans "Admninistrative acts"%}
{% trans "Year" %}{% trans "Reference" %}{% trans "Type" %}{% trans "Date" %}
{{act.signature_date.year}}{{act.ref_sra}}{{act.act_type}}{{act.signature_date}}
{% trans "No administrative act associated to this archaelogical file" %}
+ + + + + + + + + + + + + + {% for operation in item.operations.all %} + + + + + + + + + + + {% empty %} + + {% endfor %} +
{%trans "Associated operations"%}
{% trans "Year" %}{% trans "Reference" %}Code Patriarche{% trans "Type" %}{% trans "In charge" %}{% trans "Start date" %}{% trans "Excavation end date" %} 
{{operation.year}}{{operation.operation_code}}{{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 archaelogical file" %}
+ + + + + + + + + + {% for act in item.operation_acts %} + + + + + + + {% empty %} + + {% endfor %} +
{%trans "Admninistrative acts linked to associated operations"%}
{% trans "Year" %}{% trans "Reference" %}{% trans "Type" %}{% trans "Date" %}
{{act.signature_date.year}}{{act.ref_sra}}{{act.act_type}}{{act.signature_date}}
{% trans "No administrative act linked to operations" %}
+{% endblock %} diff --git a/archaeological_files/templates/ishtar/sheet_file_pdf.html b/archaeological_files/templates/ishtar/sheet_file_pdf.html new file mode 100644 index 000000000..29a4f4dec --- /dev/null +++ b/archaeological_files/templates/ishtar/sheet_file_pdf.html @@ -0,0 +1,18 @@ +{% extends "ishtar/sheet_file.html" %} +{% block css_head %} + +{% endblock %} +{% block main_head %} +{{ block.super }} +
+Ishtar – {{APP_NAME}} – {{item}} +
+{% endblock %} +{%block head_sheet%}{%endblock%} +{%block main_foot%} +
+– – +
+ + +{%endblock%} diff --git a/archaeological_files/templates/ishtar/sheet_file_window.html b/archaeological_files/templates/ishtar/sheet_file_window.html new file mode 100644 index 000000000..e3486c052 --- /dev/null +++ b/archaeological_files/templates/ishtar/sheet_file_window.html @@ -0,0 +1,3 @@ +{% extends "ishtar/sheet_file.html" %} +{% block main_head %}{%endblock%} +{% block main_foot %}{%endblock%} diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html new file mode 100644 index 000000000..1698f0224 --- /dev/null +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -0,0 +1,183 @@ +{% extends "ishtar/sheet.html" %} +{% load i18n %} +{% block content %} + +

{% trans "General"%}

+

{{ item.year }}

+{% if item.operation.operation_code %}

{{ item.operation_code }}

{% endif %} + +{% if item.code_patriarche %}

{{ item.code_patriarche }}

{%else%} +

{%trans "Patriarche OA code not yet recorded!"%}

{%endif%} + +{#

{{ item.internal_reference }}

#} + +

{{ item.history.all.0.history_date }}

+ +{% if item.start_date %}

{{ item.start_date }}

+

{{ item.excavation_end_date|default:"-" }}

+{%endif%} +{% if item.in_charge %}

{{ item.in_charge.full_label }}

{%endif%} +

{% if item.is_active %}{%trans "Active file"%}

+{% else %}{%trans "Closed operation"%}

+

{{ item.closing.date }} {%trans "by" %} {{ item.closing.user }}

+{% endif %} +

{{ item.operation_type }}

+{% if item.surface %}

{{ item.surface }} m2 ({{ item.surface_ha }} ha)

{% endif %} +{% if item.cost %}

{{ item.cost }} €{% if item.cost_by_m2 %}, ({{ item.cost_by_m2 }} €/m2){%endif%}

{%endif%} +{% if item.duration %}

{{ item.duration }} {%trans "Day"%}s

{%endif%} + +

{{ item.remains.all|join:", " }}

+

{{ item.periods.all|join:", " }}

+ +{% if item.associated_file %} +

{{ item.associated_file }}

+{% if item.associated_file.is_preventive %} +{#{% if item.operator_reference_code %}

{{ item.operator_reference_code }}

{% endif %}#} +{% if item.associated_file.town_planning_service %}

{{ item.associated_file.town_planning_service }}

{% endif %} +{% if item.associated_file.permit_type %}

{{ item.associated_file.permit_type }}

{% endif %} +{% if item.associated_file.permit_reference %}

{{ item.associated_file.permit_reference }}

{% endif %} +{% if item.associated_file.general_contractor.attached_to %}

{{ item.associated_file.general_contractor.attached_to }}

{% endif %} +{% if item.associated_file.general_contractor %}

{{ item.associated_file.general_contractor.full_label }}

{% endif %} +{% endif %} +{% endif %} + +{% if item.comment %}

{{ item.comment }}

{%endif%} + +

{% trans "Localisation"%}

+

{{ item.towns.all|join:", " }}

+ +

{{ item.associated_file.address }}

+{% if item.associated_file.address_complement %}

{{ item.associated_file.address_complement }}

{%endif%} +{% if item.associated_file.postal_code %}

{{ item.associated_file.postal_code }}

{%endif%} + +{% comment %} +

{{ item.lambert_x }}

+

{{ item.lambert_y }}

+

{{ item.altitude }}

+{% endcomment %} + + + + + + + + {##} + + {% for parcel in item.parcels.all %} + + + + + + {##} + + {% empty %} + + {% endfor %} +
{%trans "Associated parcels"%}
{% trans "Commune" %}{% trans "Year" %}{% trans "Section" %}{% trans "Parcel" %}{% trans "Owner" %}
{{parcel.town}}{{parcel.year}}{{parcel.section}}{{parcel.parcel_number}}{{operation.parcel.owner}}
{% trans "No parcel associated to this operation" %}
+ + + + + + + + + + {% for act in item.administrative_act.all %} + + + + + + + {% empty %} + + {% endfor %} +
{%trans "Admninistrative acts"%}
{% trans "Year" %}{% trans "Reference" %}{% trans "Type" %}{% trans "Date" %}
{{act.signature_date.year}}{{act.ref_sra}}{{act.act_type}}{{act.signature_date}}
{% trans "No acts associated to this operation" %}
+ +

{% trans "Scientific documentation"%}

+ + + + + + + {##} + + {% for doc in item.source.all %} + + + + + {##} + + {% empty %} + + {% endfor %} +
{%trans "Documents"%}
{% trans "Title" %}{% trans "Type" %}{% trans "Authors" %}{% trans "Localisation" %}
{{ doc.title }}{{doc.source_type}}{{ doc.authors.all|join:", " }}{{ doc.localisation }}
{% trans "No scientific document associated to this operation" %}
+ + + + + + + + + + + + {% for context_record in item.context_record.all %} + + + + {# periods ?#} + + + + + {% empty %} + + {% endfor %} +
{%trans "Context records"%}
{% trans "ID" %}{% trans "Type" %}{% trans "Chronology" %}{% trans "Description" %}{% trans "Parcel" %} 
{{ context_record.label }}{{context_record.unit|default:""}}{{ context_record.datings.all|join:", " }}{{ context_record.description }}{{ context_record.parcel.section }} - {{context_record.parcel.parcel_number}}
{% trans "No context record associated to this operation" %}
+
+ + + + + + + + + + + + + + {% for context_record in item.context_record.all %} + {% for find in context_record.base_finds.all %} + + +{# Displayed as (Patriarche operation code)-(Record unit label)-(Finds label). #} +{# or displayed as (Year)-(index)-(Record unit label)-(Finds label). #} + + + {# TODO .all|join:", " ? #} + + + + + + {#{%trans "Details"%}#} + + {% empty %} + + {% endfor %} + {% empty %} + + {% endfor %} +
{%trans "Finds"%}
{% trans "Find" %}{% trans "Material type" %}{% trans "Context record" %}{% trans "Periods" %}{% trans "Description" %}{% trans "Weight" %}{% trans "Numbers" %}{% trans "Parcel" %} 
{{ find.full_label }}{{ find.material_type_label }}{{find.context_record.label}}{{ find.get_last_find.dating}}{{ find.get_last_find.description }}{{ find.get_last_find.weight }}{{ find.get_last_find.item_number }}{{ context_record.parcel.short_label }}
{% trans "No find associated to context record" %} {{context_record.short_label}}
{% trans "No find associated to parcel" %} {{parcel.short_label}} {% trans "(no context record)" %}
+
+ +{% endblock %} diff --git a/archaeological_operations/templates/ishtar/sheet_operation_pdf.html b/archaeological_operations/templates/ishtar/sheet_operation_pdf.html new file mode 100644 index 000000000..9ef0edbf7 --- /dev/null +++ b/archaeological_operations/templates/ishtar/sheet_operation_pdf.html @@ -0,0 +1,18 @@ +{% extends "ishtar/sheet_operation.html" %} +{% block css_head %} + +{% 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_operation_window.html b/archaeological_operations/templates/ishtar/sheet_operation_window.html new file mode 100644 index 000000000..3accaff42 --- /dev/null +++ b/archaeological_operations/templates/ishtar/sheet_operation_window.html @@ -0,0 +1,3 @@ +{% extends "ishtar/sheet_operation.html" %} +{% block main_head %}{%endblock%} +{% block main_foot %}{%endblock%} diff --git a/ishtar_common/templates/ishtar/sheet.html b/ishtar_common/templates/ishtar/sheet.html new file mode 100644 index 000000000..5608a684f --- /dev/null +++ b/ishtar_common/templates/ishtar/sheet.html @@ -0,0 +1,30 @@ +{% load i18n %} +{% block main_head %} + + + + {% block title %}Ishtar{% if APP_NAME %} - {{APP_NAME}}{%endif%}{% endblock %} + + {% block css_head %} + + {% endblock %} + + +{% endblock %} +
+{% block head_sheet %} + +{% endblock %} +
+{% block content %}{% endblock %} +
+
+{%block main_foot%} + + +{%endblock%} diff --git a/ishtar_common/templates/sheet.html b/ishtar_common/templates/sheet.html deleted file mode 100644 index 5608a684f..000000000 --- a/ishtar_common/templates/sheet.html +++ /dev/null @@ -1,30 +0,0 @@ -{% load i18n %} -{% block main_head %} - - - - {% block title %}Ishtar{% if APP_NAME %} - {{APP_NAME}}{%endif%}{% endblock %} - - {% block css_head %} - - {% endblock %} - - -{% endblock %} -
-{% block head_sheet %} - -{% endblock %} -
-{% block content %}{% endblock %} -
-
-{%block main_foot%} - - -{%endblock%} diff --git a/ishtar_common/templates/sheet_contextrecord.html b/ishtar_common/templates/sheet_contextrecord.html deleted file mode 100644 index 806b06288..000000000 --- a/ishtar_common/templates/sheet_contextrecord.html +++ /dev/null @@ -1,135 +0,0 @@ -{% extends "sheet.html" %} -{% load i18n %} -{% block content %} - - -

{% trans "Context Record"%}

- -{% if item.operation.code_patriarche %} -

-{% else %} -

-

-{%endif%} -{{item.full_label}}

-{%if item.unit %} -

{{ item.unit }}

-{%endif%} -

{{ item.datings.all|join:", " }}

-

{{ item.parcel.town }}

-

{{ item.parcel.short_label }}

- -{% if item.description or item.lenght or item.width or item.depth %} -

{% trans "Description"%}

- -

{{ item.description }}

-{% if item.lenght %}

{{ item.length }}

{%endif%} -{% if item.width %}

{{ item.width }}

{%endif%} -{% if item.depth %}

{{ item.depth }}

{%endif%} -{% endif %} - -{% if item.activity or item.identification or item.interpretation %} -

{% trans "Interpretation"%}

- -{% if item.activity %}

{{ item.activity }}

{%endif%} -{% if item.identification %}

{{ item.identification }}

{%endif%} -{% if item.interpretation %}

{{ item.interpretation }}

{%endif%} -{% endif %} - -{% if item.taq or item.taq_estimated or item.tpq or item.tpq_estimated %} -

{% trans "Datations"%}

-{% if item.taq %}

{{ item.taq }}

{%endif%} -{% if item.taq_estimated %}

{{ item.taq_estimated }}

{%endif%} -{% if item.tpq %}

{{ item.tpq }}

{%endif%} -{% if item.tpq_estimated %}

{{ item.tpq_estimated }}

{%endif%} -{%endif%} - -{% if item.operation %} -

{% trans "Operation resume"%}

-

{{ item.operation.year }}

-

{{ item.operation.operation_code }}

-{% if item.operation.code_patriarche %} -

-{{ item.operation.code_patriarche }}

-{% else %}

-{%endif%} -{#

{{ item.operation.internal_reference }}

#} -

-{{ item.operation.in_charge.full_label }}

-

-{% if item.operation.is_active %} -{%trans "Active file"%}

-{% else %} -{%trans "Closed operation"%}

-

{{ item.operation.closing.date }} -{%trans "by" %} {{ item.operation.closing.user }}

-{% endif %} -

{{ item.operation.operation_type }}

-

{{ item.operation.remains.all|join:", " }}

-

{{ item.operation.periods.all|join:", " }}

-{% if item.operation.comment %}

{{ item.operation.comment }}

{%endif%} -

{% trans "Localisation"%}

-

{{ item.operation.towns.all|join:", " }}

-

-{{ item.operation }}

-{# TODO: Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related operation #} -{% else %}

-{% endif %} - - - - - - - - {##} - - {% for doc in item.source.all %} - - - - - {##} - - {% empty %} - - {% endfor %} -
{%trans "Documents"%}
{% trans "Title" %}{% trans "Type" %}{% trans "Authors" %}{% trans "Localisation" %}
{{ doc.title }}{{doc.source_type}}{{ doc.authors.all|join:", " }}{{ doc.localisation }}
{% trans "No document associated to this context record" %}
- - - - - - - - - - - - - - - {% for find in item.base_finds.all %} - - -{# Displayed as (Patriarche operation code)-(Record unit label)-(Finds label). #} -{# or displayed as (Year)-(index)-(Record unit label)-(Finds label). #} - -{# Displayed as (Patriarche operation code)-(Record unit label)-(material code)-(Finds label indexed by material type). #} -{# or displayed as (Year)-(index)-(Record unit label)-(material code)-(Finds label indexed by material type) #} - - - {# TODO .all|join:", " ? #} - - - - - - {#{%trans "Details"%}#} - - {% empty %} - - {% endfor %} -
{%trans "Finds"%}
{% trans "Find" %}{% trans "Material type" %}{% trans "Context record" %}{% trans "Periods" %}{% trans "Description" %}{% trans "Weight" %}{% trans "Numbers" %}{% trans "Parcel" %} 
{{ find.full_label }}{{ find.material_type_label }}{{find.context_record}}{{ find.get_last_find.dating}}{{ find.get_last_find.description }}{{ find.get_last_find.weight }}{{ find.get_last_find.item_number }}{{ item.context_record.parcel.short_label }}
{% trans "No find associated to this context record" %}
- -{% endblock %} diff --git a/ishtar_common/templates/sheet_contextrecord_window.html b/ishtar_common/templates/sheet_contextrecord_window.html deleted file mode 100644 index 7ff65d1e7..000000000 --- a/ishtar_common/templates/sheet_contextrecord_window.html +++ /dev/null @@ -1,3 +0,0 @@ -{% extends "sheet_contextrecord.html" %} -{% block main_head %}{%endblock%} -{% block main_foot %}{%endblock%} diff --git a/ishtar_common/templates/sheet_file.html b/ishtar_common/templates/sheet_file.html deleted file mode 100644 index 88ef1b3a2..000000000 --- a/ishtar_common/templates/sheet_file.html +++ /dev/null @@ -1,132 +0,0 @@ -{% extends "sheet.html" %} -{% load i18n %} -{% block content %} -{% if previous or next %} -
-{%if previous%} -{%trans "Previous version"%} ({{previous}}) -{% endif %} -{% if previous and next %} - {% endif %} -{%if next%} -Rollback - -{%trans "Next version"%} ({{next}}) -{% endif %} -
-{% endif %} - -

{% trans "General"%}

-

{{ item.year }}

-

{{ item.numeric_reference }}

- -

{{ item.internal_reference }}

- -

{{ item.history_date }}

-{% if item.reception_date %}

{{ item.reception_date }}

{% endif %} -

{{ item.creation_date }}

-{% comment %} -{% if item.deadline_date and not item.acts %} -

{% item.deadline_date %}

-{% endif %} -{% endcomment %} - -

{{ item.in_charge.full_label }}

-

{% if item.is_active %}{%trans "Active file"%}

-{% else %}{%trans "Closed file"%}

-

{{ item.closing.date }} {%trans "by" %} {{ item.closing.user }}

-{% endif %} - -

{{ item.file_type }}

- -{% if item.related_file %}

{{ item.related_file }}

{% endif %} -{% if item.comment %}

{{ item.comment }}

{%endif%} - -

{% trans "Localisation"%}

-

{{ item.towns.all|join:", " }}

- -

{{ item.address }}

-{% if item.address_complement %}

{{ item.address_complement }}

{%endif%} -{% if item.postal_code %}

{{ item.postal_code }}

{%endif%} - -

{% if item.total_surface %} {{ item.total_surface }} m2 ({{ item.total_surface_ha }} ha){%endif%}

- - - -{% if item.is_preventive %} -

{% trans "Preventive archaelogical file"%}

-

{{ item.total_developed_surface }} m2 ({{ item.total_developed_surface_ha }} ha)

-

{{ item.saisine_type }}

-{% if item.town_planning_service %}

{{ item.town_planning_service }}

{% endif %} -{% if item.permit_type %}

{{ item.permit_type }}

{% endif %} -{% if item.permit_reference %}

{{ item.permit_reference }}

{% endif %} -{% if item.general_contractor.attached_to %}

{{ item.general_contractor.attached_to }}

{% endif %} -{% if item.general_contractor %}

{{ item.general_contractor.full_label }}

{% endif %} -{% endif %} - - - - - - - - - - {% for act in item.administrative_act.all %} - - - - - - - {% empty %} - - {% endfor %} -
{%trans "Admninistrative acts"%}
{% trans "Year" %}{% trans "Reference" %}{% trans "Type" %}{% trans "Date" %}
{{act.signature_date.year}}{{act.ref_sra}}{{act.act_type}}{{act.signature_date}}
{% trans "No administrative act associated to this archaelogical file" %}
- - - - - - - - - - - - - - {% for operation in item.operations.all %} - - - - - - - - - - - {% empty %} - - {% endfor %} -
{%trans "Associated operations"%}
{% trans "Year" %}{% trans "Reference" %}Code Patriarche{% trans "Type" %}{% trans "In charge" %}{% trans "Start date" %}{% trans "Excavation end date" %} 
{{operation.year}}{{operation.operation_code}}{{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 archaelogical file" %}
- - - - - - - - - - {% for act in item.operation_acts %} - - - - - - - {% empty %} - - {% endfor %} -
{%trans "Admninistrative acts linked to associated operations"%}
{% trans "Year" %}{% trans "Reference" %}{% trans "Type" %}{% trans "Date" %}
{{act.signature_date.year}}{{act.ref_sra}}{{act.act_type}}{{act.signature_date}}
{% trans "No administrative act linked to operations" %}
-{% endblock %} diff --git a/ishtar_common/templates/sheet_file_pdf.html b/ishtar_common/templates/sheet_file_pdf.html deleted file mode 100644 index 3c77c75f8..000000000 --- a/ishtar_common/templates/sheet_file_pdf.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "sheet_file.html" %} -{% block css_head %} - -{% endblock %} -{% block main_head %} -{{ block.super }} -
-Ishtar – {{APP_NAME}} – {{item}} -
-{% endblock %} -{%block head_sheet%}{%endblock%} -{%block main_foot%} -
-– – -
- - -{%endblock%} diff --git a/ishtar_common/templates/sheet_file_window.html b/ishtar_common/templates/sheet_file_window.html deleted file mode 100644 index e9debdd0d..000000000 --- a/ishtar_common/templates/sheet_file_window.html +++ /dev/null @@ -1,3 +0,0 @@ -{% extends "sheet_file.html" %} -{% block main_head %}{%endblock%} -{% block main_foot %}{%endblock%} diff --git a/ishtar_common/templates/sheet_operation.html b/ishtar_common/templates/sheet_operation.html deleted file mode 100644 index 7b161f641..000000000 --- a/ishtar_common/templates/sheet_operation.html +++ /dev/null @@ -1,183 +0,0 @@ -{% extends "sheet.html" %} -{% load i18n %} -{% block content %} - -

{% trans "General"%}

-

{{ item.year }}

-{% if item.operation.operation_code %}

{{ item.operation_code }}

{% endif %} - -{% if item.code_patriarche %}

{{ item.code_patriarche }}

{%else%} -

{%trans "Patriarche OA code not yet recorded!"%}

{%endif%} - -{#

{{ item.internal_reference }}

#} - -

{{ item.history.all.0.history_date }}

- -{% if item.start_date %}

{{ item.start_date }}

-

{{ item.excavation_end_date|default:"-" }}

-{%endif%} -{% if item.in_charge %}

{{ item.in_charge.full_label }}

{%endif%} -

{% if item.is_active %}{%trans "Active file"%}

-{% else %}{%trans "Closed operation"%}

-

{{ item.closing.date }} {%trans "by" %} {{ item.closing.user }}

-{% endif %} -

{{ item.operation_type }}

-{% if item.surface %}

{{ item.surface }} m2 ({{ item.surface_ha }} ha)

{% endif %} -{% if item.cost %}

{{ item.cost }} €{% if item.cost_by_m2 %}, ({{ item.cost_by_m2 }} €/m2){%endif%}

{%endif%} -{% if item.duration %}

{{ item.duration }} {%trans "Day"%}s

{%endif%} - -

{{ item.remains.all|join:", " }}

-

{{ item.periods.all|join:", " }}

- -{% if item.associated_file %} -

{{ item.associated_file }}

-{% if item.associated_file.is_preventive %} -{#{% if item.operator_reference_code %}

{{ item.operator_reference_code }}

{% endif %}#} -{% if item.associated_file.town_planning_service %}

{{ item.associated_file.town_planning_service }}

{% endif %} -{% if item.associated_file.permit_type %}

{{ item.associated_file.permit_type }}

{% endif %} -{% if item.associated_file.permit_reference %}

{{ item.associated_file.permit_reference }}

{% endif %} -{% if item.associated_file.general_contractor.attached_to %}

{{ item.associated_file.general_contractor.attached_to }}

{% endif %} -{% if item.associated_file.general_contractor %}

{{ item.associated_file.general_contractor.full_label }}

{% endif %} -{% endif %} -{% endif %} - -{% if item.comment %}

{{ item.comment }}

{%endif%} - -

{% trans "Localisation"%}

-

{{ item.towns.all|join:", " }}

- -

{{ item.associated_file.address }}

-{% if item.associated_file.address_complement %}

{{ item.associated_file.address_complement }}

{%endif%} -{% if item.associated_file.postal_code %}

{{ item.associated_file.postal_code }}

{%endif%} - -{% comment %} -

{{ item.lambert_x }}

-

{{ item.lambert_y }}

-

{{ item.altitude }}

-{% endcomment %} - - - - - - - - {##} - - {% for parcel in item.parcels.all %} - - - - - - {##} - - {% empty %} - - {% endfor %} -
{%trans "Associated parcels"%}
{% trans "Commune" %}{% trans "Year" %}{% trans "Section" %}{% trans "Parcel" %}{% trans "Owner" %}
{{parcel.town}}{{parcel.year}}{{parcel.section}}{{parcel.parcel_number}}{{operation.parcel.owner}}
{% trans "No parcel associated to this operation" %}
- - - - - - - - - - {% for act in item.administrative_act.all %} - - - - - - - {% empty %} - - {% endfor %} -
{%trans "Admninistrative acts"%}
{% trans "Year" %}{% trans "Reference" %}{% trans "Type" %}{% trans "Date" %}
{{act.signature_date.year}}{{act.ref_sra}}{{act.act_type}}{{act.signature_date}}
{% trans "No acts associated to this operation" %}
- -

{% trans "Scientific documentation"%}

- - - - - - - {##} - - {% for doc in item.source.all %} - - - - - {##} - - {% empty %} - - {% endfor %} -
{%trans "Documents"%}
{% trans "Title" %}{% trans "Type" %}{% trans "Authors" %}{% trans "Localisation" %}
{{ doc.title }}{{doc.source_type}}{{ doc.authors.all|join:", " }}{{ doc.localisation }}
{% trans "No scientific document associated to this operation" %}
- - - - - - - - - - - - {% for context_record in item.context_record.all %} - - - - {# periods ?#} - - - - - {% empty %} - - {% endfor %} -
{%trans "Context records"%}
{% trans "ID" %}{% trans "Type" %}{% trans "Chronology" %}{% trans "Description" %}{% trans "Parcel" %} 
{{ context_record.label }}{{context_record.unit|default:""}}{{ context_record.datings.all|join:", " }}{{ context_record.description }}{{ context_record.parcel.section }} - {{context_record.parcel.parcel_number}}
{% trans "No context record associated to this operation" %}
-
- - - - - - - - - - - - - - {% for context_record in item.context_record.all %} - {% for find in context_record.base_finds.all %} - - -{# Displayed as (Patriarche operation code)-(Record unit label)-(Finds label). #} -{# or displayed as (Year)-(index)-(Record unit label)-(Finds label). #} - - - {# TODO .all|join:", " ? #} - - - - - - {#{%trans "Details"%}#} - - {% empty %} - - {% endfor %} - {% empty %} - - {% endfor %} -
{%trans "Finds"%}
{% trans "Find" %}{% trans "Material type" %}{% trans "Context record" %}{% trans "Periods" %}{% trans "Description" %}{% trans "Weight" %}{% trans "Numbers" %}{% trans "Parcel" %} 
{{ find.full_label }}{{ find.material_type_label }}{{find.context_record.label}}{{ find.get_last_find.dating}}{{ find.get_last_find.description }}{{ find.get_last_find.weight }}{{ find.get_last_find.item_number }}{{ context_record.parcel.short_label }}
{% trans "No find associated to context record" %} {{context_record.short_label}}
{% trans "No find associated to parcel" %} {{parcel.short_label}} {% trans "(no context record)" %}
-
- -{% endblock %} diff --git a/ishtar_common/templates/sheet_operation_pdf.html b/ishtar_common/templates/sheet_operation_pdf.html deleted file mode 100644 index 3397d5f43..000000000 --- a/ishtar_common/templates/sheet_operation_pdf.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "sheet_operation.html" %} -{% block css_head %} - -{% endblock %} -{% block main_head %} -{{ block.super }} -
-Ishtar – {{APP_NAME}} – {{item}} -
-{% endblock %} -{%block head_sheet%}{%endblock%} -{%block main_foot%} -
-– – -
- - -{%endblock%} diff --git a/ishtar_common/templates/sheet_operation_window.html b/ishtar_common/templates/sheet_operation_window.html deleted file mode 100644 index 9c595a1e9..000000000 --- a/ishtar_common/templates/sheet_operation_window.html +++ /dev/null @@ -1,3 +0,0 @@ -{% extends "sheet_operation.html" %} -{% block main_head %}{%endblock%} -{% block main_foot %}{%endblock%} diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 54523996f..0d0168bb9 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2010-2012 Étienne Loks +# Copyright (C) 2010-2013 Étienne Loks # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -384,7 +384,7 @@ def show_item(model, name): n.strftime('%Y%m%d-%H%M%S')) if doc_type == "odt" and settings.XHTML2ODT_PATH and \ settings.ODT_TEMPLATE: - tpl = loader.get_template('sheet_%s.html' % name) + tpl = loader.get_template('ishtar/sheet_%s.html' % name) content = tpl.render(context_instance) try: tidy_options = dict(output_xhtml=1, add_xml_decl=1, indent=1, @@ -424,7 +424,7 @@ def show_item(model, name): response.write(odtfile) return response elif doc_type == 'pdf': - tpl = loader.get_template('sheet_%s_pdf.html' % name) + tpl = loader.get_template('ishtar/sheet_%s_pdf.html' % name) content = tpl.render(context_instance) result = StringIO.StringIO() html = content.encode('utf-8') @@ -438,7 +438,7 @@ def show_item(model, name): return response return HttpResponse(content, content_type="application/xhtml") else: - tpl = loader.get_template('sheet_%s_window.html' % name) + tpl = loader.get_template('ishtar/sheet_%s_window.html' % name) content = tpl.render(context_instance) return HttpResponse(content, content_type="application/xhtml") return func -- cgit v1.2.3 From e121fde541630e72888a3314f50c3ac0fb88186d Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 4 Apr 2013 19:37:01 +0200 Subject: Operation: search by period (refs #1017) --- archaeological_operations/forms.py | 2 ++ archaeological_operations/views.py | 8 -------- ishtar_common/views.py | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) (limited to 'ishtar_common/views.py') diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 66bd05b4b..0318d4207 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -122,6 +122,8 @@ class OperationSelect(TableSelect): associated_model=Person, new=True), label=_(u"In charge")) remains = forms.ChoiceField(label=_(u"Remains"), choices=models.RemainType.get_types()) + periods = forms.ChoiceField(label=_(u"Periods"), + choices=models.Period.get_types()) year = forms.IntegerField(label=_("Year")) start_before = forms.DateField(label=_(u"Started before"), widget=widgets.JQueryDate) diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py index 6e570fc97..1ce4c4622 100644 --- a/archaeological_operations/views.py +++ b/archaeological_operations/views.py @@ -92,14 +92,6 @@ def get_available_operation_code(request, year=None): data = json.dumps({'id':models.Operation.get_available_operation_code(year)}) return HttpResponse(data, mimetype='text/plain') -def get_parcel_parser(key_section, key_number): - def func(dct): - print dct - section, number = dct.get(key_section), dct.get(key_number) - if not section or not number: - return {} - return {key_section:section, key_number:number} - get_operation = get_item(models.Operation, 'get_operation', 'operation', bool_fields = ['end_date__isnull'], dated_fields = ['start_date__lte', 'start_date__gte', diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 0d0168bb9..641ca8046 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -170,7 +170,7 @@ def format_val(val): return unicode(val) HIERARCHIC_LEVELS = 5 -HIERARCHIC_FIELDS = ['period', 'unit', 'material_type'] +HIERARCHIC_FIELDS = ['periods', 'period', 'unit', 'material_type'] PRIVATE_FIELDS = ('id', 'history_modifier', 'order') def get_item(model, func_name, default_name, extra_request_keys=[], base_request={}, bool_fields=[], dated_fields=[]): -- cgit v1.2.3