diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-12-11 17:46:46 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-12-11 17:46:46 +0100 |
commit | 35897953208aa60ee306aba73963dda34a553cb0 (patch) | |
tree | 5f60291fe22fc689f608ffc0ea8aeea9f7cd085f | |
parent | f91bdbd644a266b69667cfbca5a3b23689990817 (diff) | |
download | Ishtar-35897953208aa60ee306aba73963dda34a553cb0.tar.bz2 Ishtar-35897953208aa60ee306aba73963dda34a553cb0.zip |
Administrative act for treatment and treatment files
-rw-r--r-- | archaeological_files/urls.py | 8 | ||||
-rw-r--r-- | archaeological_files/wizards.py | 1 | ||||
-rw-r--r-- | archaeological_finds/forms.py | 341 | ||||
-rw-r--r-- | archaeological_finds/forms_treatments.py | 472 | ||||
-rw-r--r-- | archaeological_finds/ishtar_menu.py | 95 | ||||
-rw-r--r-- | archaeological_finds/urls.py | 56 | ||||
-rw-r--r-- | archaeological_finds/views.py | 121 | ||||
-rw-r--r-- | archaeological_finds/wizards.py | 60 | ||||
-rw-r--r-- | archaeological_operations/admin.py | 10 | ||||
-rw-r--r-- | archaeological_operations/migrations/0063_auto__add_field_administrativeact_treatment_file__add_field_administra.py | 822 | ||||
-rw-r--r-- | archaeological_operations/models.py | 14 | ||||
-rw-r--r-- | archaeological_operations/templates/ishtar/sheet_administrativeact.html | 48 | ||||
-rw-r--r-- | archaeological_operations/urls.py | 6 | ||||
-rw-r--r-- | archaeological_operations/wizards.py | 11 | ||||
-rw-r--r-- | archaeological_warehouse/ishtar_menu.py | 2 | ||||
-rw-r--r-- | ishtar_common/models.py | 7 | ||||
-rw-r--r-- | ishtar_common/widgets.py | 12 |
17 files changed, 1724 insertions, 362 deletions
diff --git a/archaeological_files/urls.py b/archaeological_files/urls.py index b762a54b3..91d106f78 100644 --- a/archaeological_files/urls.py +++ b/archaeological_files/urls.py @@ -50,14 +50,14 @@ urlpatterns = patterns( check_rights(['view_file', 'view_own_file'])( views.file_search_wizard), name='file_search'), - url(r'file_creation/(?P<step>.+)?$', + url(r'^file_creation/(?P<step>.+)?$', check_rights(['add_file'])( views.file_creation_wizard), name='file_creation'), - url(r'file_modification/(?P<step>.+)?$', + url(r'^file_modification/(?P<step>.+)?$', check_rights(['change_file', 'change_own_file'])( views.file_modification_wizard), name='file_modification'), - url(r'file_modify/(?P<pk>.+)/$', views.file_modify, name='file_modify'), - url(r'file_closing/(?P<step>.+)?$', + url(r'^file_modify/(?P<pk>.+)/$', views.file_modify, name='file_modify'), + url(r'^file_closing/(?P<step>.+)?$', check_rights(['change_file'])( views.file_closing_wizard), name='file_closing'), diff --git a/archaeological_files/wizards.py b/archaeological_files/wizards.py index 4c3a13ee2..1558cd46e 100644 --- a/archaeological_files/wizards.py +++ b/archaeological_files/wizards.py @@ -142,6 +142,7 @@ class FileDeletionWizard(FileClosingWizard): class FileAdministrativeActWizard(OperationAdministrativeActWizard): model = models.File current_obj_slug = 'administrativeactfile' + ref_object_key = 'associated_file' def get_reminder(self): form_key = 'selec-' + self.url_name diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index 541778d5c..78a415abf 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -21,7 +21,6 @@ Finds forms definitions """ -import datetime import logging from django import forms @@ -32,21 +31,53 @@ from django.forms.formsets import formset_factory from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ -from ishtar_common.models import Person, valid_id, valid_ids, \ - get_current_profile, Organization +from ishtar_common.models import valid_id, valid_ids, get_current_profile from archaeological_operations.models import Period, ArchaeologicalSite, \ RelationType as OpeRelationType from archaeological_context_records.models import DatingType, DatingQuality, \ ContextRecord -from archaeological_warehouse.models import Warehouse, Container import models -from ishtar_common import widgets -from archaeological_operations.widgets import OAWidget from ishtar_common.forms import FormSet, FloatField, \ get_form_selection, reverse_lazy, TableSelect, get_now, FinalForm, \ ManageOldType + from ishtar_common.forms_common import get_town_field, SourceSelect +from ishtar_common import widgets +from archaeological_operations.widgets import OAWidget + +from archaeological_finds.forms_treatments import TreatmentSelect, \ + TreatmentFormSelection, BaseTreatmentForm, ModifyTreatmentForm, \ + AdministrativeActTreatmentForm, TreatmentFormFileChoice, \ + TreatmentDeletionForm, TreatmentFileSelect, TreatmentFileFormSelection, \ + TreatmentFileForm, ModifyTreatmentFileForm, TreatmentFileDeletionForm, \ + AdministrativeActTreatmentFormSelection, \ + AdministrativeActTreatmentModifForm, \ + AdministrativeActTreatmentFileForm, \ + AdministrativeActTreatmentFileFormSelection, \ + AdministrativeActTreatmentFileModifForm + +__all__ = ['TreatmentSelect', 'TreatmentFormSelection', 'BaseTreatmentForm', + 'ModifyTreatmentForm', 'AdministrativeActTreatmentForm', + 'TreatmentFormFileChoice', 'TreatmentDeletionForm', + 'AdministrativeActTreatmentModifForm', + 'TreatmentFileSelect', 'TreatmentFileFormSelection', + 'TreatmentFileForm', 'ModifyTreatmentFileForm', + 'TreatmentFileDeletionForm', 'AdministrativeActTreatmentFileForm', + 'AdministrativeActTreatmentFileFormSelection', + 'AdministrativeActTreatmentFormSelection', + 'AdministrativeActTreatmentFileModifForm', + 'RecordFormSelection', + 'FindForm', 'DateForm', 'DatingFormSet', 'FindSelect', + 'FindFormSelection', 'MultipleFindFormSelection', + 'FindMultipleFormSelection', 'check_form', 'check_exist', + 'check_not_exist', 'check_value', 'check_type_field', + 'check_type_not_field', 'check_treatment', 'ResultFindForm', + 'ResultFindFormSet', 'FindDeletionForm', + 'UpstreamFindFormSelection', 'SourceFindFormSelection', + 'FindSourceSelect', 'FindSourceFormSelection', + 'NewFindBasketForm', 'SelectFindBasketForm', 'DeleteFindBasketForm', + 'FindBasketAddItemForm'] logger = logging.getLogger(__name__) @@ -604,304 +635,6 @@ class FindBasketAddItemForm(forms.Form): return basket -class TreatmentSelect(TableSelect): - label = forms.CharField(label=_(u"Label")) - other_reference = forms.CharField(label=_(u"Other ref.")) - year = forms.IntegerField(label=_(u"Year")) - index = forms.IntegerField(label=_(u"Index")) - treatment_types = forms.ChoiceField(label=_(u"Treatment type"), choices=[]) - image = forms.NullBooleanField(label=_(u"Has an image?")) - - def __init__(self, *args, **kwargs): - super(TreatmentSelect, self).__init__(*args, **kwargs) - self.fields['treatment_types'].choices = \ - models.TreatmentType.get_types() - self.fields['treatment_types'].help_text = \ - models.TreatmentType.get_help() - - -class TreatmentFormSelection(forms.Form): - form_label = _("Treatment search") - associated_models = {'pk': models.Treatment} - currents = {'pk': models.Treatment} - pk = forms.IntegerField( - label="", required=False, - widget=widgets.JQueryJqGrid( - reverse_lazy('get-treatment'), - TreatmentSelect, models.Treatment), - validators=[valid_id(models.Treatment)]) - - -class BaseTreatmentForm(ManageOldType, forms.Form): - form_label = _(u"Base treatment") - base_models = ['treatment_type'] - associated_models = {'treatment_type': models.TreatmentType, - 'person': Person, - 'location': Warehouse, - 'organization': Organization, - 'container': Container, - } - file_upload = True - need_user_for_initialization = True - - label = forms.CharField(label=_(u"Label"), - max_length=200, required=False) - other_reference = forms.CharField( - label=_(u"Other ref."), max_length=200, required=False) - year = forms.IntegerField(label=_("Year"), - initial=lambda: datetime.datetime.now().year, - validators=[validators.MinValueValidator(1900), - validators.MaxValueValidator(2100)]) - treatment_type = forms.MultipleChoiceField( - label=_(u"Treatment type"), choices=[], - widget=widgets.CheckboxSelectMultiple) - target_is_basket = forms.NullBooleanField(label=_(u"Target")) - person = forms.IntegerField( - label=_(u"Responsible"), - widget=widgets.JQueryAutoComplete( - reverse_lazy('autocomplete-person'), associated_model=Person, - new=True), - validators=[valid_id(Person)], required=False) - organization = forms.IntegerField( - label=_(u"Organization"), - widget=widgets.JQueryAutoComplete( - reverse_lazy('autocomplete-organization'), - associated_model=Organization, new=True), - validators=[valid_id(Organization)], required=False) - location = forms.IntegerField( - label=_(u"Location"), - widget=widgets.JQueryAutoComplete( - reverse_lazy('autocomplete-warehouse'), associated_model=Warehouse, - new=True), - validators=[valid_id(Warehouse)]) - container = forms.IntegerField( - label=_(u"Container (relevant for packaging)"), - widget=widgets.JQueryAutoComplete( - reverse_lazy('autocomplete-container'), - associated_model=Container, new=True), - validators=[valid_id(Container)], required=False) - external_id = forms.CharField( - label=_(u"External ref."), max_length=200, required=False) - comment = forms.CharField(label=_(u"Comment"), - widget=forms.Textarea, required=False) - description = forms.CharField(label=_(u"Description"), - widget=forms.Textarea, required=False) - goal = forms.CharField(label=_(u"Goal"), - widget=forms.Textarea, required=False) - start_date = forms.DateField(label=_(u"Start date"), required=False, - widget=widgets.JQueryDate) - end_date = forms.DateField(label=_(u"End date"), required=False, - widget=widgets.JQueryDate) - image = forms.ImageField( - label=_(u"Image"), help_text=mark_safe( - _(u"<p>Heavy images are resized to: %(width)dx%(height)d " - u"(ratio is preserved).</p>") % { - 'width': settings.IMAGE_MAX_SIZE[0], - 'height': settings.IMAGE_MAX_SIZE[1]}), - max_length=255, required=False, widget=widgets.ImageFileInput()) - - def __init__(self, *args, **kwargs): - user = kwargs.pop('user') - super(BaseTreatmentForm, self).__init__(*args, **kwargs) - q = Person.objects.filter(ishtaruser__pk=user.pk) - if q.count(): - person = q.all()[0] - self.fields['person'].initial = person.pk - if person.attached_to: - self.fields['organization'].initial = person.attached_to.pk - self.fields['target_is_basket'].widget.choices = \ - ((False, _(u"Single find")), (True, _(u"Basket"))) - self.fields['treatment_type'].choices = models.TreatmentType.get_types( - initial=self.init_data.get('treatment_type'), - dct={'upstream_is_many': False, 'downstream_is_many': False}, - empty_first=False - ) - self.fields['treatment_type'].help_text = \ - models.TreatmentType.get_help( - dct={'upstream_is_many': False, 'downstream_is_many': False}) - # TODO - """ - self.fields['basket'].required = False - self.fields['basket'].help_text = \ - _(u"Leave it blank if you want to select a single item") - self.fields.keyOrder.pop(self.fields.keyOrder.index('basket')) - self.fields.keyOrder.insert(self.fields.keyOrder.index('description'), - 'basket') - """ - - def clean(self, *args, **kwargs): - data = self.cleaned_data - packaging = models.TreatmentType.get_cache('packaging') - if not packaging: - logger.warning("No 'packaging' treatment type defined") - return - if data.get('container', None) \ - and str(packaging.pk) not in data.get('treatment_type', []): - raise forms.ValidationError( - _(u"The container field is attached to the treatment. If " - u"no packaging treatment is done it is not relevant.")) - if not data.get('container', None) \ - and str(packaging.pk) in data.get('treatment_type', []): - raise forms.ValidationError( - _(u"If a packaging treatment is done, the container field " - u"must be filled.")) - if not data.get('person', None) and not data.get('organization', None): - raise forms.ValidationError( - _(u"A responsible or an organization must be defined.")) - return data - # TODO - """ - for treatment_type in self.cleaned_data.get('treatment_type', []): - try: - treatment = models.TreatmentType.objects.get( - pk=treatment_type, available=True) - except models.TreatmentType.DoesNotExist: - raise forms.ValidationError(_(u"This treatment type is not " - u"available.")) - if treatment.upstream_is_many and \ - not self.cleaned_data.get('basket'): - raise forms.ValidationError(_(u"This treatment needs a " - u"basket.")) - """ - - -class ModifyTreatmentForm(BaseTreatmentForm): - index = forms.IntegerField(_(u"Index")) - id = forms.IntegerField(' ', widget=forms.HiddenInput, required=False) - - def clean(self, *args, **kwargs): - super(ModifyTreatmentForm, self).clean(*args, **kwargs) - cleaned_data = self.cleaned_data - year = cleaned_data.get('year') - pk = cleaned_data.get('id') - index = cleaned_data.get('index') - q = models.Treatment.objects\ - .filter(year=year, index=index).exclude(pk=pk) - if index and q.count(): - raise forms.ValidationError( - _(u"Another treatment with this index exists for {}." - ).format(year)) - return cleaned_data - - -class TreatmentFormFileChoice(forms.Form): - form_label = _(u"Associated file") - associated_models = {'file': models.TreatmentFile, } - currents = {'file': models.TreatmentFile} - file = forms.IntegerField( - label=_(u"Treatment file"), - widget=widgets.JQueryAutoComplete( - reverse_lazy('autocomplete-treatmentfile'), - associated_model=models.TreatmentFile), - validators=[valid_id(models.TreatmentFile)], required=False) - - -class TreatmentDeletionForm(FinalForm): - confirm_msg = _( - u"Are you sure you want to delete this treatment? All modification " - u"made to the associated finds since this treatment record will be " - u"lost!") - confirm_end_msg = _(u"Would you like to delete this treatment?") - - -class TreatmentFileSelect(TableSelect): - name = forms.CharField(label=_(u"Name")) - internal_reference = forms.CharField(label=_(u"Internal ref.")) - year = forms.IntegerField(label=_(u"Year")) - index = forms.IntegerField(label=_(u"Index")) - type = forms.ChoiceField(label=_(u"Treatment file type"), choices=[]) - - def __init__(self, *args, **kwargs): - super(TreatmentFileSelect, self).__init__(*args, **kwargs) - self.fields['type'].choices = models.TreatmentFileType.get_types() - self.fields['type'].help_text = models.TreatmentFileType.get_help() - - -class TreatmentFileFormSelection(forms.Form): - form_label = _("Treatment file search") - associated_models = {'pk': models.TreatmentFile} - currents = {'pk': models.TreatmentFile} - pk = forms.IntegerField( - label="", required=False, - widget=widgets.JQueryJqGrid( - reverse_lazy('get-treatmentfile'), - TreatmentFileSelect, models.TreatmentFile), - validators=[valid_id(models.Treatment)]) - - -class TreatmentFileForm(ManageOldType, forms.Form): - form_label = _(u"Treatment file") - base_models = ['treatment_type_type'] - associated_models = {'type': models.TreatmentFileType, - 'in_charge': Person} - need_user_for_initialization = True - - name = forms.CharField(label=_(u"Name"), - max_length=1000, required=False) - internal_reference = forms.CharField( - label=_(u"Internal ref."), max_length=60, required=False) - year = forms.IntegerField(label=_("Year"), - initial=lambda: datetime.datetime.now().year, - validators=[validators.MinValueValidator(1900), - validators.MaxValueValidator(2100)]) - type = forms.ChoiceField( - label=_(u"Treatment file type"), choices=[]) - in_charge = forms.IntegerField( - label=_(u"Responsible"), - widget=widgets.JQueryAutoComplete( - reverse_lazy('autocomplete-person'), associated_model=Person, - new=True), - validators=[valid_id(Person)]) - external_id = forms.CharField( - label=_(u"External ref."), max_length=200, required=False) - comment = forms.CharField(label=_(u"Comment"), - widget=forms.Textarea, required=False) - creation_date = forms.DateField(label=_(u"Start date"), required=False, - widget=widgets.JQueryDate, - initial=lambda: datetime.datetime.now()) - reception_date = forms.DateField(label=_(u"Reception date"), required=False, - widget=widgets.JQueryDate, - initial=lambda: datetime.datetime.now()) - end_date = forms.DateField(label=_(u"Closing date"), required=False, - widget=widgets.JQueryDate) - - def __init__(self, *args, **kwargs): - user = kwargs.pop('user') - super(TreatmentFileForm, self).__init__(*args, **kwargs) - q = Person.objects.filter(ishtaruser__pk=user.pk) - if q.count(): - person = q.all()[0] - self.fields['in_charge'].initial = person.pk - self.fields['type'].choices = models.TreatmentFileType.get_types( - initial=[self.init_data.get('type')], empty_first=False - ) - self.fields['type'].help_text = models.TreatmentFileType.get_help() - - -class ModifyTreatmentFileForm(TreatmentFileForm): - index = forms.IntegerField(_(u"Index")) - id = forms.IntegerField(' ', widget=forms.HiddenInput, required=False) - - def clean(self, *args, **kwargs): - super(ModifyTreatmentFileForm, self).clean(*args, **kwargs) - cleaned_data = self.cleaned_data - year = cleaned_data.get('year') - pk = cleaned_data.get('id') - index = cleaned_data.get('index') - q = models.TreatmentFile.objects\ - .filter(year=year, index=index).exclude(pk=pk) - if index and q.count(): - raise forms.ValidationError( - _(u"Another treatment file with this index exists for {}." - ).format(year)) - return cleaned_data - - -class TreatmentFileDeletionForm(FinalForm): - confirm_msg = _(u"Are you sure you want to delete this treatment file?") - confirm_end_msg = _(u"Would you like to delete this treatment file?") - - """ #################################### # Source management for treatments # diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py index e69de29bb..4f5bbac07 100644 --- a/archaeological_finds/forms_treatments.py +++ b/archaeological_finds/forms_treatments.py @@ -0,0 +1,472 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2016 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> + +# 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 <http://www.gnu.org/licenses/>. + +# See the file COPYING for details. + +import datetime +import logging + +from django import forms +from django.conf import settings +from django.core import validators +from django.utils.safestring import mark_safe +from django.utils.translation import ugettext_lazy as _ + +from ishtar_common.models import Person, valid_id, Organization +from archaeological_operations.models import ActType, AdministrativeAct +from archaeological_warehouse.models import Warehouse, Container +import models + +from archaeological_operations.forms import AdministrativeActOpeForm, \ + AdministrativeActOpeFormSelection, AdministrativeActModifForm + +from ishtar_common.forms import reverse_lazy, TableSelect, FinalForm, \ + ManageOldType + +from ishtar_common import widgets + +logger = logging.getLogger(__name__) + +# Treatment + + +class TreatmentSelect(TableSelect): + label = forms.CharField(label=_(u"Label")) + other_reference = forms.CharField(label=_(u"Other ref.")) + year = forms.IntegerField(label=_(u"Year")) + index = forms.IntegerField(label=_(u"Index")) + treatment_types = forms.ChoiceField(label=_(u"Treatment type"), choices=[]) + image = forms.NullBooleanField(label=_(u"Has an image?")) + + def __init__(self, *args, **kwargs): + super(TreatmentSelect, self).__init__(*args, **kwargs) + self.fields['treatment_types'].choices = \ + models.TreatmentType.get_types() + self.fields['treatment_types'].help_text = \ + models.TreatmentType.get_help() + + +class TreatmentFormSelection(forms.Form): + form_label = _("Treatment search") + associated_models = {'pk': models.Treatment} + currents = {'pk': models.Treatment} + pk = forms.IntegerField( + label="", required=False, + widget=widgets.JQueryJqGrid( + reverse_lazy('get-treatment'), + TreatmentSelect, models.Treatment), + validators=[valid_id(models.Treatment)]) + + +class BaseTreatmentForm(ManageOldType, forms.Form): + form_label = _(u"Base treatment") + base_models = ['treatment_type'] + associated_models = {'treatment_type': models.TreatmentType, + 'person': Person, + 'location': Warehouse, + 'organization': Organization, + 'container': Container, + } + file_upload = True + need_user_for_initialization = True + + label = forms.CharField(label=_(u"Label"), + max_length=200, required=False) + other_reference = forms.CharField( + label=_(u"Other ref."), max_length=200, required=False) + year = forms.IntegerField(label=_("Year"), + initial=lambda: datetime.datetime.now().year, + validators=[validators.MinValueValidator(1900), + validators.MaxValueValidator(2100)]) + treatment_type = forms.MultipleChoiceField( + label=_(u"Treatment type"), choices=[], + widget=widgets.CheckboxSelectMultiple) + target_is_basket = forms.NullBooleanField(label=_(u"Target")) + person = forms.IntegerField( + label=_(u"Responsible"), + widget=widgets.JQueryAutoComplete( + reverse_lazy('autocomplete-person'), associated_model=Person, + new=True), + validators=[valid_id(Person)], required=False) + organization = forms.IntegerField( + label=_(u"Organization"), + widget=widgets.JQueryAutoComplete( + reverse_lazy('autocomplete-organization'), + associated_model=Organization, new=True), + validators=[valid_id(Organization)], required=False) + location = forms.IntegerField( + label=_(u"Location"), + widget=widgets.JQueryAutoComplete( + reverse_lazy('autocomplete-warehouse'), associated_model=Warehouse, + new=True), + validators=[valid_id(Warehouse)]) + container = forms.IntegerField( + label=_(u"Container (relevant for packaging)"), + widget=widgets.JQueryAutoComplete( + reverse_lazy('autocomplete-container'), + associated_model=Container, new=True), + validators=[valid_id(Container)], required=False) + external_id = forms.CharField( + label=_(u"External ref."), max_length=200, required=False) + comment = forms.CharField(label=_(u"Comment"), + widget=forms.Textarea, required=False) + description = forms.CharField(label=_(u"Description"), + widget=forms.Textarea, required=False) + goal = forms.CharField(label=_(u"Goal"), + widget=forms.Textarea, required=False) + start_date = forms.DateField(label=_(u"Start date"), required=False, + widget=widgets.JQueryDate) + end_date = forms.DateField(label=_(u"End date"), required=False, + widget=widgets.JQueryDate) + image = forms.ImageField( + label=_(u"Image"), help_text=mark_safe( + _(u"<p>Heavy images are resized to: %(width)dx%(height)d " + u"(ratio is preserved).</p>") % { + 'width': settings.IMAGE_MAX_SIZE[0], + 'height': settings.IMAGE_MAX_SIZE[1]}), + max_length=255, required=False, widget=widgets.ImageFileInput()) + + def __init__(self, *args, **kwargs): + user = kwargs.pop('user') + super(BaseTreatmentForm, self).__init__(*args, **kwargs) + q = Person.objects.filter(ishtaruser__pk=user.pk) + if q.count(): + person = q.all()[0] + self.fields['person'].initial = person.pk + if person.attached_to: + self.fields['organization'].initial = person.attached_to.pk + self.fields['target_is_basket'].widget.choices = \ + ((False, _(u"Single find")), (True, _(u"Basket"))) + self.fields['treatment_type'].choices = models.TreatmentType.get_types( + initial=self.init_data.get('treatment_type'), + dct={'upstream_is_many': False, 'downstream_is_many': False}, + empty_first=False + ) + self.fields['treatment_type'].help_text = \ + models.TreatmentType.get_help( + dct={'upstream_is_many': False, 'downstream_is_many': False}) + # TODO + """ + self.fields['basket'].required = False + self.fields['basket'].help_text = \ + _(u"Leave it blank if you want to select a single item") + self.fields.keyOrder.pop(self.fields.keyOrder.index('basket')) + self.fields.keyOrder.insert(self.fields.keyOrder.index('description'), + 'basket') + """ + + def clean(self, *args, **kwargs): + data = self.cleaned_data + packaging = models.TreatmentType.get_cache('packaging') + if not packaging: + logger.warning("No 'packaging' treatment type defined") + return + if data.get('container', None) \ + and str(packaging.pk) not in data.get('treatment_type', []): + raise forms.ValidationError( + _(u"The container field is attached to the treatment. If " + u"no packaging treatment is done it is not relevant.")) + if not data.get('container', None) \ + and str(packaging.pk) in data.get('treatment_type', []): + raise forms.ValidationError( + _(u"If a packaging treatment is done, the container field " + u"must be filled.")) + if not data.get('person', None) and not data.get('organization', None): + raise forms.ValidationError( + _(u"A responsible or an organization must be defined.")) + return data + # TODO + """ + for treatment_type in self.cleaned_data.get('treatment_type', []): + try: + treatment = models.TreatmentType.objects.get( + pk=treatment_type, available=True) + except models.TreatmentType.DoesNotExist: + raise forms.ValidationError(_(u"This treatment type is not " + u"available.")) + if treatment.upstream_is_many and \ + not self.cleaned_data.get('basket'): + raise forms.ValidationError(_(u"This treatment needs a " + u"basket.")) + """ + + +class ModifyTreatmentForm(BaseTreatmentForm): + index = forms.IntegerField(_(u"Index")) + id = forms.IntegerField(' ', widget=forms.HiddenInput, required=False) + + def clean(self, *args, **kwargs): + super(ModifyTreatmentForm, self).clean(*args, **kwargs) + cleaned_data = self.cleaned_data + year = cleaned_data.get('year') + pk = cleaned_data.get('id') + index = cleaned_data.get('index') + q = models.Treatment.objects \ + .filter(year=year, index=index).exclude(pk=pk) + if index and q.count(): + raise forms.ValidationError( + _(u"Another treatment with this index exists for {}." + ).format(year)) + return cleaned_data + + +class TreatmentFormFileChoice(forms.Form): + form_label = _(u"Associated file") + associated_models = {'file': models.TreatmentFile, } + currents = {'file': models.TreatmentFile} + file = forms.IntegerField( + label=_(u"Treatment file"), + widget=widgets.JQueryAutoComplete( + reverse_lazy('autocomplete-treatmentfile'), + associated_model=models.TreatmentFile), + validators=[valid_id(models.TreatmentFile)], required=False) + + +class TreatmentDeletionForm(FinalForm): + confirm_msg = _( + u"Are you sure you want to delete this treatment? All modification " + u"made to the associated finds since this treatment record will be " + u"lost!") + confirm_end_msg = _(u"Would you like to delete this treatment?") + +# administrative act treatment + + +class AdministrativeActTreatmentSelect(TableSelect): + year = forms.IntegerField(label=_("Year")) + index = forms.IntegerField(label=_("Index")) + act_type = forms.ChoiceField(label=_("Act type"), choices=[]) + indexed = forms.NullBooleanField(label=_(u"Indexed?")) + act_object = forms.CharField(label=_(u"Object"), + max_length=300) + + signature_date_after = forms.DateField( + label=_(u"Signature date after"), widget=widgets.JQueryDate) + signature_date_before = forms.DateField( + label=_(u"Signature date before"), widget=widgets.JQueryDate) + treatment__name = forms.CharField( + label=_(u"Treatment name"), max_length=200) + treatment__year = forms.IntegerField(label=_(u"Treatment year")) + treatment__index = forms.IntegerField(label=_(u"Treatment index")) + treatment__internal_reference = forms.CharField( + max_length=200, label=_(u"Treatment internal reference")) + history_modifier = forms.IntegerField( + label=_(u"Modified by"), + widget=widgets.JQueryAutoComplete( + reverse_lazy('autocomplete-person', + args=['0', 'user']), + associated_model=Person), + validators=[valid_id(Person)]) + + def __init__(self, *args, **kwargs): + super(AdministrativeActTreatmentSelect, self).__init__(*args, **kwargs) + self.fields['act_type'].choices = ActType.get_types( + dct={'intented_to': 'T'}) + self.fields['act_type'].help_text = ActType.get_help( + dct={'intented_to': 'T'}) + + +class AdministrativeActTreatmentFormSelection( + AdministrativeActOpeFormSelection): + pk = forms.IntegerField( + label="", required=False, + widget=widgets.JQueryJqGrid( + reverse_lazy('get-administrativeacttreatment'), + AdministrativeActTreatmentSelect, AdministrativeAct), + validators=[valid_id(AdministrativeAct)]) + + +class AdministrativeActTreatmentForm(AdministrativeActOpeForm): + act_type = forms.ChoiceField(label=_(u"Act type"), choices=[]) + + def __init__(self, *args, **kwargs): + super(AdministrativeActTreatmentForm, self).__init__(*args, **kwargs) + self.fields['act_type'].choices = ActType.get_types( + initial=self.init_data.get('act_type'), + dct={'intented_to': 'T'}) + self.fields['act_type'].help_text = ActType.get_help( + dct={'intented_to': 'T'}) + + +class AdministrativeActTreatmentModifForm( + AdministrativeActModifForm, AdministrativeActTreatmentForm): + pk = forms.IntegerField(required=False, widget=forms.HiddenInput) + index = forms.IntegerField(label=_("Index"), required=False) + +# treatment files + + +class TreatmentFileSelect(TableSelect): + name = forms.CharField(label=_(u"Name")) + internal_reference = forms.CharField(label=_(u"Internal ref.")) + year = forms.IntegerField(label=_(u"Year")) + index = forms.IntegerField(label=_(u"Index")) + type = forms.ChoiceField(label=_(u"Treatment file type"), choices=[]) + + def __init__(self, *args, **kwargs): + super(TreatmentFileSelect, self).__init__(*args, **kwargs) + self.fields['type'].choices = models.TreatmentFileType.get_types() + self.fields['type'].help_text = models.TreatmentFileType.get_help() + + +class TreatmentFileFormSelection(forms.Form): + form_label = _("Treatment file search") + associated_models = {'pk': models.TreatmentFile} + currents = {'pk': models.TreatmentFile} + pk = forms.IntegerField( + label="", required=False, + widget=widgets.JQueryJqGrid( + reverse_lazy('get-treatmentfile'), + TreatmentFileSelect, models.TreatmentFile), + validators=[valid_id(models.Treatment)]) + + +class TreatmentFileForm(ManageOldType, forms.Form): + form_label = _(u"Treatment file") + base_models = ['treatment_type_type'] + associated_models = {'type': models.TreatmentFileType, + 'in_charge': Person} + need_user_for_initialization = True + + name = forms.CharField(label=_(u"Name"), + max_length=1000, required=False) + internal_reference = forms.CharField( + label=_(u"Internal ref."), max_length=60, required=False) + year = forms.IntegerField(label=_("Year"), + initial=lambda: datetime.datetime.now().year, + validators=[validators.MinValueValidator(1900), + validators.MaxValueValidator(2100)]) + type = forms.ChoiceField( + label=_(u"Treatment file type"), choices=[]) + in_charge = forms.IntegerField( + label=_(u"Responsible"), + widget=widgets.JQueryAutoComplete( + reverse_lazy('autocomplete-person'), associated_model=Person, + new=True), + validators=[valid_id(Person)]) + external_id = forms.CharField( + label=_(u"External ref."), max_length=200, required=False) + comment = forms.CharField(label=_(u"Comment"), + widget=forms.Textarea, required=False) + creation_date = forms.DateField(label=_(u"Start date"), required=False, + widget=widgets.JQueryDate, + initial=lambda: datetime.datetime.now()) + reception_date = forms.DateField(label=_(u"Reception date"), required=False, + widget=widgets.JQueryDate, + initial=lambda: datetime.datetime.now()) + end_date = forms.DateField(label=_(u"Closing date"), required=False, + widget=widgets.JQueryDate) + + def __init__(self, *args, **kwargs): + user = kwargs.pop('user') + super(TreatmentFileForm, self).__init__(*args, **kwargs) + q = Person.objects.filter(ishtaruser__pk=user.pk) + if q.count(): + person = q.all()[0] + self.fields['in_charge'].initial = person.pk + self.fields['type'].choices = models.TreatmentFileType.get_types( + initial=[self.init_data.get('type')], empty_first=False + ) + self.fields['type'].help_text = models.TreatmentFileType.get_help() + + +class ModifyTreatmentFileForm(TreatmentFileForm): + index = forms.IntegerField(_(u"Index")) + id = forms.IntegerField(' ', widget=forms.HiddenInput, required=False) + + def clean(self, *args, **kwargs): + super(ModifyTreatmentFileForm, self).clean(*args, **kwargs) + cleaned_data = self.cleaned_data + year = cleaned_data.get('year') + pk = cleaned_data.get('id') + index = cleaned_data.get('index') + q = models.TreatmentFile.objects \ + .filter(year=year, index=index).exclude(pk=pk) + if index and q.count(): + raise forms.ValidationError( + _(u"Another treatment file with this index exists for {}." + ).format(year)) + return cleaned_data + + +class TreatmentFileDeletionForm(FinalForm): + confirm_msg = _(u"Are you sure you want to delete this treatment file?") + confirm_end_msg = _(u"Would you like to delete this treatment file?") + + +class AdministrativeActTreatmentFileSelect(TableSelect): + year = forms.IntegerField(label=_("Year")) + index = forms.IntegerField(label=_("Index")) + act_type = forms.ChoiceField(label=_("Act type"), choices=[]) + indexed = forms.NullBooleanField(label=_(u"Indexed?")) + act_object = forms.CharField(label=_(u"Object"), + max_length=300) + + signature_date_after = forms.DateField( + label=_(u"Signature date after"), widget=widgets.JQueryDate) + signature_date_before = forms.DateField( + label=_(u"Signature date before"), widget=widgets.JQueryDate) + treatment_file__name = forms.CharField( + label=_(u"Treatment file name"), max_length=200) + treatment_file__year = forms.IntegerField(label=_(u"Treatment file year")) + treatment_file__index = forms.IntegerField(label=_(u"Treatment file index")) + treatment_file__internal_reference = forms.CharField( + max_length=200, label=_(u"Treatment file internal reference")) + history_modifier = forms.IntegerField( + label=_(u"Modified by"), + widget=widgets.JQueryAutoComplete( + reverse_lazy('autocomplete-person', + args=['0', 'user']), + associated_model=Person), + validators=[valid_id(Person)]) + + def __init__(self, *args, **kwargs): + super(AdministrativeActTreatmentFileSelect, self).__init__(*args, + **kwargs) + self.fields['act_type'].choices = ActType.get_types( + dct={'intented_to': 'TF'}) + self.fields['act_type'].help_text = ActType.get_help( + dct={'intented_to': 'TF'}) + + +class AdministrativeActTreatmentFileFormSelection( + AdministrativeActOpeFormSelection): + pk = forms.IntegerField( + label="", required=False, + widget=widgets.JQueryJqGrid( + reverse_lazy('get-administrativeacttreatmentfile'), + AdministrativeActTreatmentFileSelect, AdministrativeAct), + validators=[valid_id(AdministrativeAct)]) + + +class AdministrativeActTreatmentFileForm(AdministrativeActOpeForm): + act_type = forms.ChoiceField(label=_(u"Act type"), choices=[]) + + def __init__(self, *args, **kwargs): + super(AdministrativeActTreatmentFileForm, self).__init__(*args, + **kwargs) + self.fields['act_type'].choices = ActType.get_types( + initial=self.init_data.get('act_type'), + dct={'intented_to': 'TF'}) + self.fields['act_type'].help_text = ActType.get_help( + dct={'intented_to': 'TF'}) + + +class AdministrativeActTreatmentFileModifForm( + AdministrativeActModifForm, AdministrativeActTreatmentFileForm): + pk = forms.IntegerField(required=False, widget=forms.HiddenInput) + index = forms.IntegerField(label=_("Index"), required=False) diff --git a/archaeological_finds/ishtar_menu.py b/archaeological_finds/ishtar_menu.py index 7824c94fe..39cc5d910 100644 --- a/archaeological_finds/ishtar_menu.py +++ b/archaeological_finds/ishtar_menu.py @@ -21,6 +21,7 @@ from django.utils.translation import ugettext_lazy as _ from ishtar_common.menu_base import SectionItem, MenuItem +from archaeological_operations.models import AdministrativeAct import models # be carreful: each access_controls must be relevant with check_rights in urls @@ -103,33 +104,60 @@ MENU_SECTIONS = [ ])), (60, SectionItem( - 'treatment_management', _(u"Treatment"), + 'treatmentfle_management', _(u"Treatment file"), profile_restriction='warehouse', childs=[ + MenuItem('treatmentfle_search', + _(u"Search"), + model=models.TreatmentFile, + access_controls=['view_find', + 'view_own_find']), + MenuItem('treatmentfle_creation', + _(u"Creation"), + model=models.TreatmentFile, + access_controls=['change_find', + 'change_own_find']), + MenuItem('treatmentfle_modification', + _(u"Modification"), + model=models.TreatmentFile, + access_controls=['change_find', + 'change_own_find']), + MenuItem('treatmentfle_deletion', + _(u"Deletion"), + model=models.TreatmentFile, + access_controls=['change_find', + 'change_own_find']), SectionItem( - 'find_treatmentfiles', _(u"Treatment Files"), + 'admin_act_fletreatments', _(u"Administrative act"), childs=[ - MenuItem('treatmentfle_search', + MenuItem('treatmentfle_admacttreatmentfle_search', _(u"Search"), - model=models.TreatmentFile, - access_controls=['view_find', - 'view_own_find']), - MenuItem('treatmentfle_creation', + model=AdministrativeAct, + access_controls=['change_administrativeact']), + MenuItem('treatmentfle_admacttreatmentfle', _(u"Creation"), - model=models.TreatmentFile, - access_controls=['change_find', - 'change_own_find']), - MenuItem('treatmentfle_modification', - _(u"Modification"), - model=models.TreatmentFile, - access_controls=['change_find', - 'change_own_find']), - MenuItem('treatmentfle_deletion', + model=AdministrativeAct, + access_controls=['change_administrativeact']), + MenuItem('treatmentfle_admacttreatmentfle_modification', + _(u"Modification"), model=AdministrativeAct, + access_controls=['change_administrativeact']), + MenuItem('treatmentfle_admacttreatmentfle_deletion', _(u"Deletion"), - model=models.TreatmentFile, - access_controls=['change_find', - 'change_own_find']), - ]), + model=AdministrativeAct, + access_controls=['change_administrativeact']), + MenuItem('treatmentfle_administrativeact_document', + _(u"Documents"), + model=AdministrativeAct, + access_controls=['change_administrativeact']), + ] + ) + ] + )), + (70, + SectionItem( + 'treatment_management', _(u"Treatment"), + profile_restriction='warehouse', + childs=[ SectionItem( 'find_treatments', _(u"Simple treatments"), childs=[ @@ -154,6 +182,31 @@ MENU_SECTIONS = [ access_controls=['change_find', 'change_own_find']), ]), - ] + SectionItem( + 'admin_act_treatments', _(u"Administrative act"), + childs=[ + MenuItem('treatment_admacttreatment_search', + _(u"Search"), + model=AdministrativeAct, + access_controls=['change_administrativeact']), + MenuItem('treatment_admacttreatment', + _(u"Creation"), + model=AdministrativeAct, + access_controls=['change_administrativeact']), + MenuItem( + 'treatment_admacttreatment_modification', + _(u"Modification"), model=AdministrativeAct, + access_controls=['change_administrativeact']), + MenuItem('treatment_admacttreatment_deletion', + _(u"Deletion"), + model=AdministrativeAct, + access_controls=['change_administrativeact']), + MenuItem('treatment_admacttreatment_document', + _(u"Documents"), + model=AdministrativeAct, + access_controls=['change_administrativeact']), + ] + ) + ] )), ] diff --git a/archaeological_finds/urls.py b/archaeological_finds/urls.py index c780b14fb..120fa1ed0 100644 --- a/archaeological_finds/urls.py +++ b/archaeological_finds/urls.py @@ -88,20 +88,65 @@ urlpatterns = patterns( url(r'^find_basket_deletion/$', check_rights(['change_find', 'change_own_find'])( views.DeleteFindBasketView.as_view()), name='delete_findbasket'), - url(r'treatment_creation/(?P<step>.+)?$', + url(r'^treatment_creation/(?P<step>.+)?$', check_rights(['change_find', 'change_own_find'])( views.treatment_creation_wizard), name='treatment_creation'), - url(r'treatment_modification/(?P<step>.+)?$', + url(r'^treatment_modification/(?P<step>.+)?$', check_rights(['change_find', 'change_own_find'])( views.treatment_modification_wizard), name='treatment_modification'), - url(r'treatment_search/(?P<step>.+)?$', + url(r'^treatment_search/(?P<step>.+)?$', check_rights(['view_find', 'view_own_find'])( views.treatment_search_wizard), name='treatment_search'), url(r'^treatment_deletion/(?P<step>.+)?$', check_rights(['change_find', 'change_own_find'])( views.treatment_deletion_wizard), name='treatment_deletion'), - url(r'treatmentfle_search/(?P<step>.+)?$', + + url(r'^treatment_admacttreatment_search/(?P<step>.+)?$', + check_rights(['change_administrativeact'])( + views.treatment_administrativeact_search_wizard), + name='treatment_admacttreatment_search'), + url(r'^treatment_admacttreatment/(?P<step>.+)?$', + check_rights(['change_administrativeact'])( + views.treatment_administrativeact_wizard), + name='treatment_admacttreatment'), + url(r'^treatment_admacttreatment_modification/(?P<step>.+)?$', + check_rights(['change_administrativeact'])( + views.treatment_administrativeact_modification_wizard), + name='treatment_admacttreatment_modification'), + url(r'^treatment_administrativeacttreatment_modify/(?P<pk>.+)/$', + views.treatment_administrativeacttreatment_modify, + name='treatment_administrativeacttreatment_modify'), + url(r'^treatment_admacttreatment_deletion/(?P<step>.+)?$', + check_rights(['change_administrativeact'])( + views.treatment_admacttreatment_deletion_wizard), + name='treatment_admacttreatment_deletion'), + url(r'^get-administrativeacttreatment/(?P<type>.+)?$', + views.get_administrativeacttreatment, + name='get-administrativeacttreatment'), + + url(r'^treatmentfle_admacttreatmentfle_search/(?P<step>.+)?$', + check_rights(['change_administrativeact'])( + views.treatmentfile_admacttreatmentfile_search_wizard), + name='treatmentfle_admacttreatmentfle_search'), + url(r'^treatmentfle_admacttreatmentfle_modification/(?P<step>.+)?$', + check_rights(['change_administrativeact'])( + views.treatmentfile_admacttreatmentfile_modification_wizard), + name='treatmentfle_admacttreatmentfle_modification'), + url(r'^treatmentfle_admacttreatmentfle/(?P<step>.+)?$', + check_rights(['change_administrativeact'])( + views.treatmentfile_admacttreatmentfile_wizard), + name='treatmentfle_admacttreatmentfle'), + url(r'^treatmentfile_administrativeacttreatmentfile_modify/(?P<pk>.+)/$', + views.treatmentfile_administrativeacttreatmentfile_modify, + name='treatmentfile_administrativeacttreatmentfile_modify'), + url(r'^treatmentfle_admacttreatmentfle_deletion/(?P<step>.+)?$', + check_rights(['change_administrativeact'])( + views.treatmentfile_admacttreatmentfile_deletion_wizard), + name='treatmentfle_admacttreatmentfle_deletion'), + + + url(r'^treatmentfle_search/(?P<step>.+)?$', check_rights(['change_find', 'change_own_find'])( views.treatmentfile_search_wizard), name='treatmentfile_search'), @@ -117,6 +162,9 @@ urlpatterns = patterns( check_rights(['change_find', 'change_own_find'])( views.treatmentfile_deletion_wizard), name='treatmentfile_deletion'), + url(r'get-administrativeacttreatmentfile/(?P<type>.+)?$', + views.get_administrativeacttreatmentfile, + name='get-administrativeacttreatmentfile'), url(r'get-upstreamtreatment/(?P<type>.+)?$', views.get_upstreamtreatment, name='get-upstreamtreatment'), url(r'get-downstreamtreatment/(?P<type>.+)?$', diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py index 1b08e9853..35c7d5976 100644 --- a/archaeological_finds/views.py +++ b/archaeological_finds/views.py @@ -28,16 +28,21 @@ from django.utils.translation import ugettext_lazy as _ from django.views.generic import TemplateView from django.views.generic.edit import CreateView, FormView +from ishtar_common.models import IshtarUser +from archaeological_operations.models import AdministrativeAct + from ishtar_common.forms import FinalForm from ishtar_common.forms_common import SourceForm, AuthorFormset, \ SourceDeletionForm -from ishtar_common.models import IshtarUser +from archaeological_operations.forms import FinalAdministrativeActDeleteForm from archaeological_context_records.forms \ import RecordFormSelection as RecordFormSelectionTable from ishtar_common.views import get_item, show_item, revert_item, \ get_autocomplete_generic, IshtarMixin, LoginRequiredMixin + from ishtar_common.wizards import SearchWizard +from archaeological_operations.wizards import AdministrativeActDeletionWizard from wizards import * from forms import * @@ -55,10 +60,20 @@ get_find_for_treatment = get_item( show_treatment = show_item(models.Treatment, 'treatment') get_treatment = get_item(models.Treatment, 'get_treatement', 'treatment') +get_administrativeacttreatment = get_item( + AdministrativeAct, 'get_administrativeacttreatment', + 'administrativeacttreatment', + base_request={"treatment__pk__isnull": False}) + show_treatmentfile = show_item(models.TreatmentFile, 'treatmentfile') get_treatmentfile = get_item(models.TreatmentFile, 'get_treatementfile', 'treatmentfile') +get_administrativeacttreatmentfile = get_item( + AdministrativeAct, 'get_administrativeacttreatmentfile', + 'administrativeacttreatmentfile', + base_request={"treatment_file__pk__isnull": False}) + def autocomplete_treatmentfile(request): if not request.user.has_perm('ishtar_common.view_treatment', @@ -375,6 +390,59 @@ treatment_deletion_wizard = TreatmentDeletionWizard.as_view([ label=_(u"Treatment deletion"), url_name='treatment_deletion',) +treatment_administrativeact_search_wizard = \ + SearchWizard.as_view([ + ('selec-treatment_admacttreatment_search', + AdministrativeActTreatmentFormSelection)], + label=_(u"Treatment: search administrative act"), + url_name='treatment_admacttreatment_search',) + +treatment_administrativeact_wizard = \ + TreatmentAdministrativeActWizard.as_view([ + ('selec-treatment_admacttreatment', TreatmentFormSelection), + ('administrativeact-treatment_admacttreatment', + AdministrativeActTreatmentForm), + ('final-treatment_admacttreatment', FinalForm)], + label=_(u"Treatment: new administrative act"), + url_name='treatment_admacttreatment',) + +treatment_administrativeact_modification_wizard = \ + TreatmentEditAdministrativeActWizard.as_view([ + ('selec-treatment_admacttreatment_modification', + AdministrativeActTreatmentFormSelection), + ('administrativeact-treatment_admacttreatment_modification', + AdministrativeActTreatmentModifForm), + ('final-treatment_admacttreatment_modification', FinalForm)], + label=_(u"Treatment: administrative act modification"), + url_name='treatment_admacttreatment_modification',) + +treatment_admacttreatment_deletion_wizard = \ + AdministrativeActDeletionWizard.as_view([ + ('selec-treatment_admacttreatment_deletion', + AdministrativeActTreatmentFormSelection), + ('final-treatment_admacttreatment_deletion', + FinalAdministrativeActDeleteForm)], + label=_(u"Treatment: administrative act deletion"), + url_name='treatment_admacttreatment_deletion',) + + +def treatment_administrativeacttreatment_modify(request, pk): + treatment_administrativeact_modification_wizard(request) + TreatmentEditAdministrativeActWizard.session_set_value( + request, + 'selec-treatment_admacttreatment_modification', + 'pk', pk, reset=True) + return redirect( + reverse( + 'treatment_admacttreatment_modification', + kwargs={ + 'step': + 'administrativeact-treatment_admacttreatment_modification' + })) + + +# treatment file + treatmentfile_search_wizard = SearchWizard.as_view([ ('general-treatmentfile_search', TreatmentFileFormSelection)], label=_(u"Treatment file search"), @@ -404,6 +472,57 @@ treatmentfile_deletion_wizard = TreatmentFileDeletionWizard.as_view([ label=_(u"Treatment file deletion"), url_name='treatmentfile_deletion',) +treatmentfile_admacttreatmentfile_search_wizard = \ + SearchWizard.as_view([ + ('selec-treatmentfle_admacttreatmentfle_search', + AdministrativeActTreatmentFileFormSelection)], + label=_(u"Treatment file: search administrative act"), + url_name='treatmentfle_admacttreatmentfle_search',) + + +treatmentfile_admacttreatmentfile_wizard = \ + TreatmentFileAdministrativeActWizard.as_view([ + ('selec-treatmentfle_admacttreatmentfle', TreatmentFileFormSelection), + ('admact-treatmentfle_admacttreatmentfle', + AdministrativeActTreatmentFileForm), + ('final-treatmentfle_admacttreatmentfle', FinalForm)], + label=_(u"Treatment file: new administrative act"), + url_name='treatmentfle_admacttreatmentfle',) + +treatmentfile_admacttreatmentfile_modification_wizard = \ + TreatmentFileEditAdministrativeActWizard.as_view([ + ('selec-treatmentfle_admacttreatmentfle_modification', + AdministrativeActTreatmentFileFormSelection), + ('admact-treatmentfle_admacttreatmentfle_modification', + AdministrativeActTreatmentFileModifForm), + ('final-treatmentfle_admacttreatmentfle_modification', FinalForm)], + label=_(u"Treatment file: administrative act modification"), + url_name='treatmentfle_admacttreatmentfle_modification',) + +treatmentfile_admacttreatmentfile_deletion_wizard = \ + AdministrativeActDeletionWizard.as_view([ + ('selec-treatmentfle_admacttreatmentfle_deletion', + AdministrativeActTreatmentFileFormSelection), + ('final-treatmentfle_admacttreatmentfle_deletion', + FinalAdministrativeActDeleteForm)], + label=_(u"Treatment file: administrative act deletion"), + url_name='treatmentfle_admacttreatmentfle_deletion',) + + +def treatmentfile_administrativeacttreatmentfile_modify(request, pk): + treatmentfile_admacttreatmentfile_modification_wizard(request) + TreatmentFileEditAdministrativeActWizard.session_set_value( + request, + 'selec-treatmentfle_admacttreatmentfle_modification', + 'pk', pk, reset=True) + return redirect( + reverse( + 'treatmentfle_admacttreatmentfle_modification', + kwargs={ + 'step': + 'admact-treatmentfle_admacttreatmentfle_modification' + })) + """ treatment_source_creation_wizard = TreatmentSourceWizard.as_view([ ('selec-treatment_source_creation', SourceTreatmentFormSelection), diff --git a/archaeological_finds/wizards.py b/archaeological_finds/wizards.py index eb838eb66..f5f43f1e6 100644 --- a/archaeological_finds/wizards.py +++ b/archaeological_finds/wizards.py @@ -22,6 +22,9 @@ from django.utils.translation import ugettext_lazy as _ from ishtar_common.forms import reverse_lazy from ishtar_common.wizards import Wizard, DeletionWizard, SourceWizard +from archaeological_operations.wizards import OperationAdministrativeActWizard + +from archaeological_operations.models import AdministrativeAct import models @@ -129,6 +132,23 @@ class TreatmentDeletionWizard(DeletionWizard): 'goal', 'start_date', 'end_date', 'container'] +class TreatmentAdministrativeActWizard(OperationAdministrativeActWizard): + model = models.Treatment + current_obj_slug = 'administrativeacttreatment' + ref_object_key = 'treatment' + + def get_reminder(self): + return + + +class TreatmentEditAdministrativeActWizard(TreatmentAdministrativeActWizard): + model = AdministrativeAct + edit = True + + def get_associated_item(self, dct): + return self.get_current_object().treatment + + class TreatmentFileWizard(Wizard): model = models.TreatmentFile wizard_done_window = reverse_lazy('show-treatmentfile') @@ -145,6 +165,46 @@ class TreatmentFileDeletionWizard(DeletionWizard): 'creation_date', 'end_date', 'comment'] +class TreatmentFileAdministrativeActWizard( + OperationAdministrativeActWizard): + model = models.TreatmentFile + current_obj_slug = 'administrativeacttreatmentfile' + ref_object_key = 'treatment_file' + + def get_reminder(self): + form_key = 'selec-' + self.url_name + if self.url_name.endswith('_administrativeactop'): + # modification and deletion are suffixed with '_modification' + # and '_deletion' so it is creation + pk = self.session_get_value(form_key, "pk") + try: + return ( + (_(u"Treatment file"), + unicode(models.Operation.objects.get(pk=pk))), + ) + except models.TreatmentFile.DoesNotExist: + return + else: + admin_id = self.session_get_value(form_key, "pk") + try: + admin = AdministrativeAct.objects.get(pk=admin_id) + if not admin.operation: + return + return ((_(u"Operation"), unicode(admin.operation)),) + except AdministrativeAct.DoesNotExist: + return + return + + +class TreatmentFileEditAdministrativeActWizard( + TreatmentFileAdministrativeActWizard): + model = AdministrativeAct + edit = True + + def get_associated_item(self, dct): + return self.get_current_object().treatment_file + + class FindSourceWizard(SourceWizard): wizard_done_window = reverse_lazy('show-findsource') model = models.FindSource diff --git a/archaeological_operations/admin.py b/archaeological_operations/admin.py index 47ab8419b..b97df85eb 100644 --- a/archaeological_operations/admin.py +++ b/archaeological_operations/admin.py @@ -100,7 +100,15 @@ class RelationTypeAdmin(admin.ModelAdmin): admin.site.register(models.RelationType, RelationTypeAdmin) -general_models = [models.RemainType, models.ActType, models.ReportState] + +class ActTypeAdmin(GeneralTypeAdmin): + list_filter = ('intented_to',) + list_display = ['label', 'txt_idx', 'available', 'intented_to'] + + +admin.site.register(models.ActType, ActTypeAdmin) + +general_models = [models.RemainType, models.ReportState] for model in general_models: admin.site.register(model, GeneralTypeAdmin) diff --git a/archaeological_operations/migrations/0063_auto__add_field_administrativeact_treatment_file__add_field_administra.py b/archaeological_operations/migrations/0063_auto__add_field_administrativeact_treatment_file__add_field_administra.py new file mode 100644 index 000000000..671de79ec --- /dev/null +++ b/archaeological_operations/migrations/0063_auto__add_field_administrativeact_treatment_file__add_field_administra.py @@ -0,0 +1,822 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding field 'AdministrativeAct.treatment_file' + db.add_column('archaeological_operations_administrativeact', 'treatment_file', + self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='administrative_act', null=True, to=orm['archaeological_finds.TreatmentFile']), + keep_default=False) + + # Adding field 'AdministrativeAct.treatment' + db.add_column('archaeological_operations_administrativeact', 'treatment', + self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='administrative_act', null=True, to=orm['archaeological_finds.Treatment']), + keep_default=False) + + + # Changing field 'ActType.intented_to' + db.alter_column('archaeological_operations_acttype', 'intented_to', self.gf('django.db.models.fields.CharField')(max_length=2)) + # Adding field 'HistoricalAdministrativeAct.treatment_file_id' + db.add_column('archaeological_operations_historicaladministrativeact', 'treatment_file_id', + self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True), + keep_default=False) + + # Adding field 'HistoricalAdministrativeAct.treatment_id' + db.add_column('archaeological_operations_historicaladministrativeact', 'treatment_id', + self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'AdministrativeAct.treatment_file' + db.delete_column('archaeological_operations_administrativeact', 'treatment_file_id') + + # Deleting field 'AdministrativeAct.treatment' + db.delete_column('archaeological_operations_administrativeact', 'treatment_id') + + + # Changing field 'ActType.intented_to' + db.alter_column('archaeological_operations_acttype', 'intented_to', self.gf('django.db.models.fields.CharField')(max_length=1)) + # Deleting field 'HistoricalAdministrativeAct.treatment_file_id' + db.delete_column('archaeological_operations_historicaladministrativeact', 'treatment_file_id') + + # Deleting field 'HistoricalAdministrativeAct.treatment_id' + db.delete_column('archaeological_operations_historicaladministrativeact', 'treatment_id') + + + models = { + 'archaeological_files.file': { + 'Meta': {'ordering': "('cached_label',)", 'object_name': 'File'}, + 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'auto_external_id': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'cached_label': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'cira_advised': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'classified_area': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'corporation_general_contractor': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'general_contractor_files'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Organization']"}), + 'creation_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today', 'null': 'True', 'blank': 'True'}), + 'departments': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'file_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.FileType']"}), + 'general_contractor': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'general_contractor_files'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), + 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'imported_line': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_archaeological_files_file'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), + 'in_charge': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'file_responsability'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), + 'instruction_deadline': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'internal_reference': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'}), + 'locality': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'main_town': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'file_main'", 'null': 'True', 'to': "orm['ishtar_common.Town']"}), + 'mh_listing': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'mh_register': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'numeric_reference': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'organization': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'files'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Organization']"}), + 'permit_reference': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'permit_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.PermitType']", 'null': 'True', 'blank': 'True'}), + 'planning_service': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'planning_service_files'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Organization']"}), + 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'protected_area': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'raw_general_contractor': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'raw_town_planning_service': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'reception_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'related_file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.File']", 'null': 'True', 'blank': 'True'}), + 'requested_operation_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.OperationType']"}), + 'research_comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'responsible_town_planning_service': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'responsible_town_planning_service_files'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), + 'saisine_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.SaisineType']", 'null': 'True', 'blank': 'True'}), + 'scientist': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'scientist'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), + 'total_developed_surface': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), + 'total_surface': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), + 'towns': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'file'", 'symmetrical': 'False', 'to': "orm['ishtar_common.Town']"}), + 'year': ('django.db.models.fields.IntegerField', [], {'default': '2016'}) + }, + 'archaeological_files.filetype': { + 'Meta': {'ordering': "('label',)", 'object_name': 'FileType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'archaeological_files.permittype': { + 'Meta': {'ordering': "('label',)", 'object_name': 'PermitType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'archaeological_files.saisinetype': { + 'Meta': {'ordering': "('label',)", 'object_name': 'SaisineType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'delay': ('django.db.models.fields.IntegerField', [], {'default': '30'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'archaeological_finds.treatment': { + 'Meta': {'unique_together': "(('year', 'index'),)", 'object_name': 'Treatment'}, + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'container': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_warehouse.Container']", 'null': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'file': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'treatments'", 'null': 'True', 'to': "orm['archaeological_finds.TreatmentFile']"}), + 'goal': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_archaeological_finds_treatment'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), + 'index': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'location': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_warehouse.Warehouse']", 'null': 'True', 'blank': 'True'}), + 'organization': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'treatments'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Organization']"}), + 'other_reference': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'person': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'treatments'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'target_is_basket': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'thumbnail': ('django.db.models.fields.files.ImageField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'treatment_types': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['archaeological_finds.TreatmentType']", 'symmetrical': 'False'}), + 'year': ('django.db.models.fields.IntegerField', [], {'default': '2016'}) + }, + 'archaeological_finds.treatmentfile': { + 'Meta': {'ordering': "('cached_label',)", 'unique_together': "(('year', 'index'),)", 'object_name': 'TreatmentFile'}, + 'cached_label': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'creation_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today', 'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_archaeological_finds_treatmentfile'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), + 'in_charge': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'treatmentfile_responsability'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), + 'index': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'internal_reference': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'reception_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_finds.TreatmentFileType']"}), + 'year': ('django.db.models.fields.IntegerField', [], {'default': '2016'}) + }, + 'archaeological_finds.treatmentfiletype': { + 'Meta': {'ordering': "('label',)", 'object_name': 'TreatmentFileType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'archaeological_finds.treatmenttype': { + 'Meta': {'ordering': "('label',)", 'object_name': 'TreatmentType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'downstream_is_many': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), + 'upstream_is_many': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'virtual': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + }, + 'archaeological_operations.acttype': { + 'Meta': {'ordering': "('label',)", 'object_name': 'ActType'}, + 'associated_template': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'acttypes'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.DocumentTemplate']"}), + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'indexed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'intented_to': ('django.db.models.fields.CharField', [], {'max_length': '2'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'archaeological_operations.administrativeact': { + 'Meta': {'ordering': "('year', 'signature_date', 'index', 'act_type')", 'object_name': 'AdministrativeAct'}, + 'act_object': ('django.db.models.fields.TextField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'act_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.ActType']"}), + 'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'administrative_act'", 'null': 'True', 'to': "orm['archaeological_files.File']"}), + 'departments_label': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_archaeological_operations_administrativeact'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), + 'in_charge': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'adminact_operation_in_charge'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), + 'index': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'operation': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'administrative_act'", 'null': 'True', 'to': "orm['archaeological_operations.Operation']"}), + 'operator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'adminact_operator'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Organization']"}), + 'ref_sra': ('django.db.models.fields.CharField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}), + 'scientist': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'adminact_scientist'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), + 'signatory': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'signatory'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), + 'signature_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'towns_label': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'treatment': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'administrative_act'", 'null': 'True', 'to': "orm['archaeological_finds.Treatment']"}), + 'treatment_file': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'administrative_act'", 'null': 'True', 'to': "orm['archaeological_finds.TreatmentFile']"}), + 'year': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'archaeological_operations.archaeologicalsite': { + 'Meta': {'object_name': 'ArchaeologicalSite'}, + 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_archaeological_operations_archaeologicalsite'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'periods': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['archaeological_operations.Period']", 'null': 'True', 'blank': 'True'}), + 'reference': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}), + 'remains': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['archaeological_operations.RemainType']", 'null': 'True', 'blank': 'True'}) + }, + 'archaeological_operations.historicaladministrativeact': { + 'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalAdministrativeAct'}, + 'act_object': ('django.db.models.fields.TextField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'act_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'associated_file_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'departments_label': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'history_creator_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'history_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'history_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'history_modifier_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'history_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'history_user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), + 'id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'blank': 'True'}), + 'in_charge_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'index': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'operation_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'operator_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'ref_sra': ('django.db.models.fields.CharField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}), + 'scientist_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'signatory_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'signature_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'towns_label': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'treatment_file_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'treatment_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'year': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'archaeological_operations.historicaloperation': { + 'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalOperation'}, + 'abstract': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'associated_file_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'cached_label': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}), + 'cira_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'cira_rapporteur_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'code_patriarche': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'common_name': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'cost': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'creation_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today'}), + 'documentation_deadline': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'documentation_received': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'eas_number': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), + 'effective_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'excavation_end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'finds_deadline': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'finds_received': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'fnap_cost': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'fnap_financing': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), + 'geoarchaeological_context_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'history_creator_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'history_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'history_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'history_modifier_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'history_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'history_user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), + 'id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'blank': 'True'}), + 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'in_charge_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'large_area_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'multi_polygon': ('django.contrib.gis.db.models.fields.MultiPolygonField', [], {'null': 'True', 'blank': 'True'}), + 'negative_result': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'old_code': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'operation_code': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'operation_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'operator_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'operator_reference': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), + 'optional_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'point': ('django.contrib.gis.db.models.fields.PointField', [], {'null': 'True', 'blank': 'True'}), + 'record_quality': ('django.db.models.fields.CharField', [], {'max_length': '2', 'null': 'True', 'blank': 'True'}), + 'report_delivery_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'report_processing_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'scheduled_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'scientific_documentation_comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'scientist_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'thumbnail': ('django.db.models.fields.files.ImageField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'virtual_operation': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'year': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'zoning_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}) + }, + 'archaeological_operations.operation': { + 'Meta': {'ordering': "('cached_label',)", 'object_name': 'Operation'}, + 'abstract': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'archaeological_sites': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['archaeological_operations.ArchaeologicalSite']", 'null': 'True', 'blank': 'True'}), + 'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'operations'", 'null': 'True', 'to': "orm['archaeological_files.File']"}), + 'cached_label': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}), + 'cira_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'cira_rapporteur': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'cira_rapporteur'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), + 'code_patriarche': ('django.db.models.fields.IntegerField', [], {'unique': 'True', 'null': 'True', 'blank': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'common_name': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'cost': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'creation_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today'}), + 'documentation_deadline': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'documentation_received': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'eas_number': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), + 'effective_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'excavation_end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'finds_deadline': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'finds_received': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'fnap_cost': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'fnap_financing': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), + 'geoarchaeological_context_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_archaeological_operations_operation'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), + 'in_charge': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'operation_responsability'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), + 'large_area_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'multi_polygon': ('django.contrib.gis.db.models.fields.MultiPolygonField', [], {'null': 'True', 'blank': 'True'}), + 'negative_result': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'old_code': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'operation_code': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'operation_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['ishtar_common.OperationType']"}), + 'operator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'operator'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Organization']"}), + 'operator_reference': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), + 'optional_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'periods': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['archaeological_operations.Period']", 'null': 'True', 'blank': 'True'}), + 'point': ('django.contrib.gis.db.models.fields.PointField', [], {'null': 'True', 'blank': 'True'}), + 'record_quality': ('django.db.models.fields.CharField', [], {'max_length': '2', 'null': 'True', 'blank': 'True'}), + 'remains': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['archaeological_operations.RemainType']", 'null': 'True', 'blank': 'True'}), + 'report_delivery_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'report_processing': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.ReportState']", 'null': 'True', 'blank': 'True'}), + 'scheduled_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'scientific_documentation_comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'scientist': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'operation_scientist_responsability'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'thumbnail': ('django.db.models.fields.files.ImageField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'towns': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'operations'", 'symmetrical': 'False', 'to': "orm['ishtar_common.Town']"}), + 'virtual_operation': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'year': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'zoning_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}) + }, + 'archaeological_operations.operationbydepartment': { + 'Meta': {'object_name': 'OperationByDepartment', 'db_table': "'operation_department'", 'managed': 'False'}, + 'department': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'operation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.Operation']"}) + }, + 'archaeological_operations.operationsource': { + 'Meta': {'object_name': 'OperationSource'}, + 'additional_information': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'associated_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'operationsource_related'", 'symmetrical': 'False', 'to': "orm['ishtar_common.Author']"}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'creation_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'duplicate': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '12', 'null': 'True', 'blank': 'True'}), + 'format_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Format']", 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'index': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'internal_reference': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'item_number': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'operation': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'source'", 'to': "orm['archaeological_operations.Operation']"}), + 'receipt_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'receipt_date_in_documentation': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'reference': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'scale': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), + 'source_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.SourceType']"}), + 'support_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.SupportType']", 'null': 'True', 'blank': 'True'}), + 'thumbnail': ('django.db.models.fields.files.ImageField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}) + }, + 'archaeological_operations.operationtypeold': { + 'Meta': {'ordering': "['-preventive', 'order', 'label']", 'object_name': 'OperationTypeOld'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'preventive': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'archaeological_operations.parcel': { + 'Meta': {'ordering': "('year', 'section', 'parcel_number')", 'object_name': 'Parcel'}, + 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parcels'", 'null': 'True', 'to': "orm['archaeological_files.File']"}), + 'auto_external_id': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'history_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_archaeological_operations_parcel'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), + 'operation': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parcels'", 'null': 'True', 'to': "orm['archaeological_operations.Operation']"}), + 'parcel_number': ('django.db.models.fields.CharField', [], {'max_length': '6', 'null': 'True', 'blank': 'True'}), + 'public_domain': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'section': ('django.db.models.fields.CharField', [], {'max_length': '4', 'null': 'True', 'blank': 'True'}), + 'town': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'parcels'", 'to': "orm['ishtar_common.Town']"}), + 'year': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'archaeological_operations.parcelowner': { + 'Meta': {'object_name': 'ParcelOwner'}, + 'end_date': ('django.db.models.fields.DateField', [], {}), + 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'history_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_archaeological_operations_parcelowner'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'parcel_owner'", 'to': "orm['ishtar_common.Person']"}), + 'parcel': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'owners'", 'to': "orm['archaeological_operations.Parcel']"}), + 'start_date': ('django.db.models.fields.DateField', [], {}) + }, + 'archaeological_operations.period': { + 'Meta': {'ordering': "('order',)", 'object_name': 'Period'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.IntegerField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.Period']", 'null': 'True', 'blank': 'True'}), + 'start_date': ('django.db.models.fields.IntegerField', [], {}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'archaeological_operations.recordrelations': { + 'Meta': {'ordering': "('left_record', 'relation_type')", 'object_name': 'RecordRelations'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'left_record': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'right_relations'", 'to': "orm['archaeological_operations.Operation']"}), + 'relation_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.RelationType']"}), + 'right_record': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'left_relations'", 'to': "orm['archaeological_operations.Operation']"}) + }, + 'archaeological_operations.relationtype': { + 'Meta': {'ordering': "('order', 'label')", 'object_name': 'RelationType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'inverse_relation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.RelationType']", 'null': 'True', 'blank': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'symmetrical': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'tiny_label': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'archaeological_operations.remaintype': { + 'Meta': {'ordering': "('label',)", 'object_name': 'RemainType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'archaeological_operations.reportstate': { + 'Meta': {'ordering': "('order',)", 'object_name': 'ReportState'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'archaeological_warehouse.container': { + 'Meta': {'object_name': 'Container'}, + 'comment': ('django.db.models.fields.TextField', [], {}), + 'container_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_warehouse.ContainerType']"}), + 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'history_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_archaeological_warehouse_container'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), + 'location': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_warehouse.Warehouse']"}), + 'reference': ('django.db.models.fields.CharField', [], {'max_length': '40'}) + }, + 'archaeological_warehouse.containertype': { + 'Meta': {'ordering': "('label',)", 'object_name': 'ContainerType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'length': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'reference': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), + 'volume': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'archaeological_warehouse.warehouse': { + 'Meta': {'object_name': 'Warehouse'}, + 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'alt_address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'alt_address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'alt_address_is_prefered': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'alt_country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), + 'alt_postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'alt_town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_archaeological_warehouse_warehouse'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), + 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '40'}), + 'person_in_charge': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'warehouse_in_charge'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), + 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'phone2': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'phone3': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'phone_desc': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'phone_desc2': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'phone_desc3': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'raw_phone': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'}), + 'warehouse_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_warehouse.WarehouseType']"}) + }, + 'archaeological_warehouse.warehousetype': { + 'Meta': {'ordering': "('label',)", 'object_name': 'WarehouseType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'ishtar_common.arrondissement': { + 'Meta': {'object_name': 'Arrondissement'}, + 'department': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'}) + }, + 'ishtar_common.author': { + 'Meta': {'object_name': 'Author'}, + 'author_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.AuthorType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'person': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'author'", 'to': "orm['ishtar_common.Person']"}) + }, + 'ishtar_common.authortype': { + 'Meta': {'object_name': 'AuthorType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'ishtar_common.canton': { + 'Meta': {'object_name': 'Canton'}, + 'arrondissement': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Arrondissement']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'}) + }, + 'ishtar_common.department': { + 'Meta': {'ordering': "['number']", 'object_name': 'Department'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'number': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '3'}), + 'state': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.State']", 'null': 'True', 'blank': 'True'}) + }, + 'ishtar_common.documenttemplate': { + 'Meta': {'ordering': "['associated_object_name', 'name']", 'object_name': 'DocumentTemplate'}, + 'associated_object_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'template': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) + }, + 'ishtar_common.format': { + 'Meta': {'object_name': 'Format'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'ishtar_common.import': { + 'Meta': {'object_name': 'Import'}, + 'conservative_import': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}), + 'encoding': ('django.db.models.fields.CharField', [], {'default': "'utf-8'", 'max_length': '15'}), + 'end_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'error_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'imported_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), + 'imported_images': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'importer_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.ImporterType']"}), + 'match_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'result_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'seconds_remaining': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'skip_lines': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'state': ('django.db.models.fields.CharField', [], {'default': "'C'", 'max_length': '2'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.IshtarUser']"}) + }, + 'ishtar_common.importertype': { + 'Meta': {'object_name': 'ImporterType'}, + 'associated_models': ('django.db.models.fields.CharField', [], {'max_length': '200'}), + 'description': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_template': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '100', 'unique': 'True', 'null': 'True', 'blank': 'True'}), + 'unicity_keys': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}), + 'users': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['ishtar_common.IshtarUser']", 'null': 'True', 'blank': 'True'}) + }, + 'ishtar_common.ishtaruser': { + 'Meta': {'object_name': 'IshtarUser', '_ormbases': ['auth.User']}, + 'advanced_shortcut_menu': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'person': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ishtaruser'", 'unique': 'True', 'to': "orm['ishtar_common.Person']"}), + 'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'}) + }, + 'ishtar_common.operationtype': { + 'Meta': {'ordering': "['-preventive', 'order', 'label']", 'object_name': 'OperationType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'preventive': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'ishtar_common.organization': { + 'Meta': {'object_name': 'Organization'}, + 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'alt_address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'alt_address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'alt_address_is_prefered': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'alt_country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), + 'alt_postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'alt_town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'}), + 'archived': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}), + 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_ishtar_common_organization'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), + 'merge_candidate': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_candidate_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Organization']"}), + 'merge_exclusion': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_exclusion_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Organization']"}), + 'merge_key': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '500'}), + 'organization_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.OrganizationType']"}), + 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'phone2': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'phone3': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'phone_desc': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'phone_desc2': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'phone_desc3': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'raw_phone': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'}) + }, + 'ishtar_common.organizationtype': { + 'Meta': {'ordering': "('label',)", 'object_name': 'OrganizationType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'ishtar_common.person': { + 'Meta': {'object_name': 'Person'}, + 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'alt_address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'alt_address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'alt_address_is_prefered': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'alt_country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), + 'alt_postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'alt_town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'}), + 'archived': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}), + 'attached_to': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'members'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Organization']"}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'contact_type': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_ishtar_common_person'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), + 'merge_candidate': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_candidate_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), + 'merge_exclusion': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_exclusion_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), + 'merge_key': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'old_title': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'person_types': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ishtar_common.PersonType']", 'symmetrical': 'False'}), + 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'phone2': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'phone3': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'phone_desc': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'phone_desc2': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'phone_desc3': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'raw_name': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'raw_phone': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'salutation': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'surname': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'title': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.TitleType']", 'null': 'True', 'blank': 'True'}), + 'town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'}) + }, + 'ishtar_common.persontype': { + 'Meta': {'ordering': "('label',)", 'object_name': 'PersonType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['auth.Group']", 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'ishtar_common.sourcetype': { + 'Meta': {'object_name': 'SourceType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'ishtar_common.state': { + 'Meta': {'ordering': "['number']", 'object_name': 'State'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'number': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '3'}) + }, + 'ishtar_common.supporttype': { + 'Meta': {'object_name': 'SupportType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'ishtar_common.titletype': { + 'Meta': {'ordering': "('label',)", 'object_name': 'TitleType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'ishtar_common.town': { + 'Meta': {'ordering': "['numero_insee']", 'object_name': 'Town'}, + 'canton': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Canton']", 'null': 'True', 'blank': 'True'}), + 'center': ('django.contrib.gis.db.models.fields.PointField', [], {'srid': '27572', 'null': 'True', 'blank': 'True'}), + 'departement': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_ishtar_common_town'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'numero_insee': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '6'}), + 'surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + } + } + + complete_apps = ['archaeological_operations']
\ No newline at end of file diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index c54a060cb..307d02e97 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -882,8 +882,10 @@ class OperationSource(Source): class ActType(GeneralType): TYPE = (('F', _(u'Archaeological file')), ('O', _(u'Operation')), + ('TF', _(u'Treatment file')), + ('T', _(u'Treatment')), ) - intented_to = models.CharField(_(u"Intended to"), max_length=1, + intented_to = models.CharField(_(u"Intended to"), max_length=2, choices=TYPE) code = models.CharField(_(u"Code"), max_length=10, blank=True, null=True) associated_template = models.ManyToManyField( @@ -988,6 +990,16 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter): blank=True, null=True, related_name='administrative_act', verbose_name=_(u"Archaeological file")) + treatment_file = models.ForeignKey( + 'archaeological_finds.TreatmentFile', + blank=True, null=True, + related_name='administrative_act', + verbose_name=_(u"Treatment file")) + treatment = models.ForeignKey( + 'archaeological_finds.Treatment', + blank=True, null=True, + related_name='administrative_act', + verbose_name=_(u"Treatment")) signature_date = models.DateField(_(u"Signature date"), blank=True, null=True) year = models.IntegerField(_(u"Year"), blank=True, null=True) diff --git a/archaeological_operations/templates/ishtar/sheet_administrativeact.html b/archaeological_operations/templates/ishtar/sheet_administrativeact.html index 57acf9cbe..c96d216c9 100644 --- a/archaeological_operations/templates/ishtar/sheet_administrativeact.html +++ b/archaeological_operations/templates/ishtar/sheet_administrativeact.html @@ -1,32 +1,46 @@ {% extends "ishtar/sheet.html" %} -{% load i18n window_header %} +{% load i18n window_header window_field %} {% block head_title %}{% trans "Administrative act" %}{% endblock %} {% block content %} {% if item.operation %} {% window_nav item window_id 'show-administrativeact' 'operation_administrativeactop_modify' %} -{% else %} +{% endif %} +{% if item.associated_file %} {% window_nav item window_id 'show-administrativeact' 'file_administrativeactfile_modify' %} {% endif %} +{% if item.treatment %} +{% window_nav item window_id 'show-administrativeact' 'treatment_administrativeacttreatment_modify' %} +{% endif %} +{% if item.treatment_file %} +{% window_nav item window_id 'show-administrativeact' 'treatmentfile_administrativeacttreatmentfile_modify' %} +{% endif %} <h3>{% trans "General"%}</h3> -<p><label>{%trans "Year:"%}</label> <span class='value strong'>{{ item.year }}</span></p> -{% if item.index %}<p><label>{%trans "Numerical reference:"%}</label> <span class='value strong'>{{ item.index }}</span></p>{% endif %} -{% if item.ref_sra %}<p><label>{%trans "Internal reference:"%}</label> <span class='value strong'>{{ item.ref_sra }}</span></p>{% endif %} -<p><label>{%trans "Type:"%}</label> <span class='value'>{{ item.act_type }}</span></p> -{% if item.act_object %}<p><label>{%trans "Object:"%}</label> <span class='value'>{{ item.act_object }}</span></p>{% endif %} -<p><label>{%trans "Signature date:"%}</label> <span class='value'>{{ item.signature_date }}</span></p> -<p><label>{%trans "In charge:"%}</label> <span class='value'>{{ item.in_charge.full_label }}</span></p> -{% if item.operator %}<p><label>{%trans "Archaeological preventive operator:"%}</label> <span class='value'>{{ item.operator }}</span></p>{% endif %} - -{% if item.associated_file %}<p><label>{%trans "Associated file:"%}</label> <span class='value'><a href='#' onclick='load_window("{% url show-file item.associated_file.pk ''%}")'>{{ item.associated_file }}</a></span></p>{% endif %} <!-- Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related file --> -{% if item.operation %}<p><label>{%trans "Associated operation:"%}</label> <span class='value'><a href='#' onclick='load_window("{% url show-operation item.operation.pk ''%}")'>{{ item.operation }}</a></span></p>{% endif %} <!-- Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related operation --> +<ul class='form-flex'> + {% field_li "Year" item.year %} + {% field_li "Index" item.index %} + {% field_li "Internal reference" item.ref_sra %} + {% field_li "Type" item.act_type %} + {% field_li "Object" item.act_object %} + {% field_li "Signature date" item.signature_date %} + {% field_li "In charge" item.in_charge %} + {% field_li "Archaeological preventive operator" item.operator %} + {% field_li_detail "Associated file" item.associated_file %} + {% field_li_detail "Operation" item.operation %} + {% field_li_detail "Treatment" item.treatment %} + {% field_li_detail "Treatment file" item.treatment_file %} -{% if item.operation %}{% if item.operation.surface %}<p><label>{%trans "Surface:"%}</label> <span class='value'>{{ item.operation.surface }} m<sup>2</sup> ({{ item.operation.surface_ha }} ha)</span></p>{%endif%} {% endif %} -<p><label>{%trans "Created by:"%}</label> <span class='value'>{{ item.history_creator.ishtaruser.full_label }}</span></p> -{%comment%}{% if item.general_contractor.attached_to %}<p><label>{%trans "General contractor organisation:"%}</label> <span class='value'>{{ item.general_contractor.attached_to }}</span></p>{% endif %} <!-- Contractor's organisation displayed as concat of Name/Adress/postal_code/city --> + {% if item.operation and item.operation.surface %} + <li><label>{% trans "Surface:"%}</label> <span class='value'>{{ item.operation.surface }} m<sup>2</sup> ({{ item.operation.surface_ha }} ha)</span></li> + {% endif %} + {% field_li "Created by" item.history_creator.ishtaruser %} +{% comment %}{% if item.general_contractor.attached_to %}<p> + <label>{% trans "General contractor organisation:"%}</label> + <span class='value'>{{ item.general_contractor.attached_to }}</span></p>{% endif %} <!-- Contractor's organisation displayed as concat of Name/Adress/postal_code/city --> {% if item.general_contractor %}<p><label>{%trans "General contractor:"%}</label> <span class='value'>{{ item.general_contractor.full_label }}</span></p>{% endif %} -{%endcomment%} +{% endcomment %} +</ul> {% endblock %} diff --git a/archaeological_operations/urls.py b/archaeological_operations/urls.py index aca98d4c4..710bc5e24 100644 --- a/archaeological_operations/urls.py +++ b/archaeological_operations/urls.py @@ -128,9 +128,13 @@ urlpatterns += patterns( # allow specialization for operations url(r'show-administrativeact(?:/(?P<pk>.+))?/(?P<type>.+)?$', 'show_administrativeact', name='show-administrativeactop'), - # allow specialization for files + # allow specialization for files, treatment, treatment file url(r'show-administrativeact(?:/(?P<pk>.+))?/(?P<type>.+)?$', 'show_administrativeact', name='show-administrativeactfile'), + url(r'show-administrativeact(?:/(?P<pk>.+))?/(?P<type>.+)?$', + 'show_administrativeact', name='show-administrativeacttreatment'), + url(r'show-administrativeact(?:/(?P<pk>.+))?/(?P<type>.+)?$', + 'show_administrativeact', name='show-administrativeacttreatmentfile'), url(r'generatedoc-administrativeactop/(?P<pk>.+)?/(?P<template_pk>.+)?$', 'generatedoc_administrativeactop', name='generatedoc-administrativeactop'), diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py index ece14d1d2..94aafb87c 100644 --- a/archaeological_operations/wizards.py +++ b/archaeological_operations/wizards.py @@ -17,6 +17,8 @@ # See the file COPYING for details. +import logging + from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse @@ -33,6 +35,8 @@ from forms import GenerateDocForm from archaeological_files.models import File +logger = logging.getLogger(__name__) + class OperationWizard(Wizard): model = models.Operation @@ -327,6 +331,7 @@ class OperationAdministrativeActWizard(OperationWizard): edit = False wizard_done_window = reverse_lazy('show-administrativeact') current_obj_slug = 'administrativeactop' + ref_object_key = 'operation' def get_reminder(self): form_key = 'selec-' + self.url_name @@ -389,11 +394,9 @@ class OperationAdministrativeActWizard(OperationWizard): else: associated_item = self.get_associated_item(dct) if not associated_item: + logger.warning("Admin act save: no associated model") return self.render(form_list[-1]) - if isinstance(associated_item, File): - dct['associated_file'] = associated_item - elif isinstance(associated_item, models.Operation): - dct['operation'] = associated_item + dct[self.ref_object_key] = associated_item admact = models.AdministrativeAct(**dct) admact.save() dct['item'] = admact diff --git a/archaeological_warehouse/ishtar_menu.py b/archaeological_warehouse/ishtar_menu.py index 1844b0018..c69ad760d 100644 --- a/archaeological_warehouse/ishtar_menu.py +++ b/archaeological_warehouse/ishtar_menu.py @@ -27,7 +27,7 @@ from archaeological_finds.models import Treatment MENU_SECTIONS = [ - (60, SectionItem('treatment_management', _(u"Treatment"), + (70, SectionItem('treatment_management', _(u"Treatment"), profile_restriction='warehouse', childs=[ MenuItem('warehouse_packaging', _(u"Packaging"), diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 25fa73132..d4f0c595e 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -413,6 +413,8 @@ class GeneralType(Cached, models.Model): new_vals = [] if not initial: return [] + if type(initial) not in (list, tuple): + initial = [initial] for value in initial: try: pk = int(value) @@ -486,7 +488,10 @@ class GeneralType(Cached, models.Model): pass items = cls.objects.filter(**dct) if default and default != "None": - exclude.append(default.txt_idx) + if hasattr(default, 'txt_idx'): + exclude.append(default.txt_idx) + else: + exclude.append(default) if exclude: items = items.exclude(txt_idx__in=exclude) for item in items.order_by(*cls._meta.ordering).all(): diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py index 7611a08df..be0ab8cba 100644 --- a/ishtar_common/widgets.py +++ b/ishtar_common/widgets.py @@ -19,9 +19,11 @@ # See the file COPYING for details. +import logging + from django import forms from django.conf import settings -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse, NoReverseMatch from django.db.models import fields from django.forms import ClearableFileInput from django.forms.widgets import flatatt, \ @@ -37,6 +39,8 @@ from django.utils.translation import ugettext_lazy as _ from ishtar_common import models +logger = logging.getLogger(__name__) + reverse_lazy = lazy(reverse, unicode) @@ -639,7 +643,11 @@ class JQueryJqGrid(forms.RadioSelect): col_idx = col_idx and ", ".join(col_idx) or "" dct['encoding'] = settings.ENCODING or 'utf-8' - dct['source'] = unicode(self.source) + try: + dct['source'] = unicode(self.source) + except NoReverseMatch: + logger.warning('Cannot resolve source for {} widget'.format( + self.form)) if unicode(self.source_full) and unicode(self.source_full) != 'None': dct['source_full'] = unicode(self.source_full) |