diff options
Diffstat (limited to 'archaeological_operations')
-rw-r--r-- | archaeological_operations/forms.py | 16 | ||||
-rw-r--r-- | archaeological_operations/migrations/0023_auto_20180413_1147.py | 45 | ||||
-rw-r--r-- | archaeological_operations/models.py | 8 | ||||
-rw-r--r-- | archaeological_operations/templates/ishtar/sheet_operation.html | 9 | ||||
-rw-r--r-- | archaeological_operations/views.py | 13 | ||||
-rw-r--r-- | archaeological_operations/wizards.py | 22 |
6 files changed, 111 insertions, 2 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 9906709d9..bb2393ab9 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -997,6 +997,22 @@ OperationFormModifGeneral.associated_models = \ OperationFormModifGeneral.associated_models['associated_file'] = File +class CourtOrderedSeizureForm(CustomForm, IshtarForm): + form_label = _(u"Court-ordered seizure") + form_admin_name = _(u"Operation - 015 - Court-ordered seizure") + form_slug = "operation-015-court-ordered-seizure" + + seizure_name = forms.CharField( + label=_(u"Seizure name"), required=False, + ) + official_report_number = forms.CharField( + label=_(u"Official report number"), required=False, + ) + name_of_the_protagonist = forms.CharField( + label=_(u"Name of the protagonist"), required=False, + ) + + class CollaboratorForm(CustomForm, IshtarForm): form_label = _(u"Collaborators") form_admin_name = _(u"Operation - 020 - Collaborators") diff --git a/archaeological_operations/migrations/0023_auto_20180413_1147.py b/archaeological_operations/migrations/0023_auto_20180413_1147.py new file mode 100644 index 000000000..421f0e3e2 --- /dev/null +++ b/archaeological_operations/migrations/0023_auto_20180413_1147.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.10 on 2018-04-13 11:47 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_operations', '0022_auto_20180403_1120'), + ] + + operations = [ + migrations.AddField( + model_name='historicaloperation', + name='name_of_the_protagonist', + field=models.TextField(blank=True, null=True, verbose_name='Name of the protagonist'), + ), + migrations.AddField( + model_name='historicaloperation', + name='official_report_number', + field=models.TextField(blank=True, null=True, verbose_name='Official report number'), + ), + migrations.AddField( + model_name='historicaloperation', + name='seizure_name', + field=models.TextField(blank=True, null=True, verbose_name='Seizure name'), + ), + migrations.AddField( + model_name='operation', + name='name_of_the_protagonist', + field=models.TextField(blank=True, null=True, verbose_name='Name of the protagonist'), + ), + migrations.AddField( + model_name='operation', + name='official_report_number', + field=models.TextField(blank=True, null=True, verbose_name='Official report number'), + ), + migrations.AddField( + model_name='operation', + name='seizure_name', + field=models.TextField(blank=True, null=True, verbose_name='Seizure name'), + ), + ] diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 6daf9dc12..12c1cce8e 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -468,6 +468,14 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, finds_received = models.NullBooleanField( _(u"Finds received"), blank=True, null=True) + # judiciary + seizure_name = models.TextField(_(u"Seizure name"), blank=True, null=True) + official_report_number = models.TextField(_(u"Official report number"), + blank=True, null=True) + name_of_the_protagonist = models.TextField(_(u"Name of the protagonist"), + blank=True, null=True) + + # gis point = models.PointField(_(u"Point"), blank=True, null=True) multi_polygon = models.MultiPolygonField(_(u"Multi polygon"), blank=True, null=True) diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index 3be570326..8530d0579 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -131,6 +131,15 @@ </div> {% endif %} +{% if item.seizure_name or item.official_report_number or item.name_of_the_protagonist %} +<h3>{% trans "Court-ordered seizure"%}</h3> +<div class="row"> + {% field_flex "Seizure name" item.seizure_name %} + {% field_flex "Official report number" item.official_report_number %} + {% field_flex "Name of the protagonist" item.name_of_the_protagonist %} +</div> +{% endif %} + {% if not next %} {% if item.towns.count %} <h3>{% trans "Localisation"%}</h3> diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py index 61c9e6c19..fcd6c3252 100644 --- a/archaeological_operations/views.py +++ b/archaeological_operations/views.py @@ -44,13 +44,14 @@ from archaeological_operations.forms import ArchaeologicalSiteForm, \ AdministrativeActOpeFormSelection, AdministrativeActOpeForm, \ AdministrativeActOpeModifForm, FinalAdministrativeActDeleteForm, \ AdministrativeActRegisterFormSelection, DocumentGenerationAdminActForm, \ - SiteForm, SiteTownFormset, SiteUnderwaterForm, check_underwater_module + SiteForm, SiteTownFormset, SiteUnderwaterForm, check_underwater_module, \ + CourtOrderedSeizureForm from ishtar_common.views import get_item, show_item, revert_item, new_item from ishtar_common.wizards import SearchWizard, check_rights_condition from archaeological_operations.wizards import has_associated_file, \ - is_preventive, OperationWizard, OperationModificationWizard, \ + is_preventive, is_judiciary, OperationWizard, OperationModificationWizard, \ OperationClosingWizard, OperationDeletionWizard, SiteSearch, \ OperationSourceWizard, OperationSourceDeletionWizard, \ OperationAdministrativeActWizard, OperationEditAdministrativeActWizard, \ @@ -192,6 +193,7 @@ operation_search_wizard = SearchWizard.as_view( wizard_steps = [ ('filechoice-operation_creation', OperationFormFileChoice), ('general-operation_creation', OperationFormGeneral), + ('judiciary-operation_creation', CourtOrderedSeizureForm), ('collaborators-operation_creation', CollaboratorForm), ('archaeologicalsite-operation_creation', ArchaeologicalSiteFormSet), ('preventive-operation_creation', OperationFormPreventive), @@ -223,6 +225,9 @@ check_files_for_operation = get_check_files_for_operation() ope_crea_condition_dict = { 'filechoice-operation_creation': check_files_for_operation, + 'judiciary-operation_creation': is_judiciary( + 'general-operation_creation', models.OperationType, 'operation_type', + ), 'preventive-operation_creation': get_check_files_for_operation( is_preventive('general-operation_creation', models.OperationType, @@ -250,6 +255,7 @@ operation_creation_wizard = OperationWizard.as_view( operation_modif_wizard_steps = [ ('selec-operation_modification', OperationFormSelection), ('general-operation_modification', OperationFormModifGeneral), + ('judiciary-operation_modification', CourtOrderedSeizureForm), ('collaborators-operation_modification', CollaboratorForm), ('archaeologicalsite-operation_modification', ArchaeologicalSiteFormSet), ('preventive-operation_modification', OperationFormPreventive), @@ -275,6 +281,9 @@ ope_modif_condition_dict = { get_check_files_for_operation( is_preventive('general-operation_modification', models.OperationType, 'operation_type', 'arch_diagnostic')), + 'judiciary-operation_modification': is_judiciary( + 'general-operation_modification', models.OperationType, 'operation_type', + ), 'townsgeneral-operation_modification': has_associated_file( 'general-operation_modification', negate=True), 'towns-operation_modification': has_associated_file( diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py index ddad8dd2e..d4830a2e7 100644 --- a/archaeological_operations/wizards.py +++ b/archaeological_operations/wizards.py @@ -526,6 +526,28 @@ def is_not_preventive(form_name, model, type_key='operation_type', key=''): return func +def is_judiciary(form_name, model, type_key='operation_type'): + def func(self): + request = self.request + storage = self.storage + if storage.prefix not in request.session or \ + 'step_data' not in request.session[storage.prefix] or \ + form_name not in request.session[storage.prefix]['step_data'] \ + or form_name + '-' + type_key not in \ + request.session[storage.prefix]['step_data'][form_name]: + return False + try: + typ = request.session[storage.prefix][ + 'step_data'][form_name][form_name + '-' + type_key] + if type(typ) in (list, tuple): + typ = typ[0] + typ = int(typ) + return model.is_judiciary(typ) + except ValueError: + return False + return func + + def has_associated_file(form_name, file_key='associated_file', negate=False): def func(self): request = self.request |