diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-04-07 12:22:27 +0200 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-04-07 12:22:27 +0200 |
| commit | 93364489ab4e6daf16f924b2d8212f7fcdc5e477 (patch) | |
| tree | e0686c289c399330f414b50ff8ef58f642833db2 /archaeological_operations/views.py | |
| parent | c788bef47de6bca5dda5dd1fa67dd6a2ac02e9b9 (diff) | |
| parent | a8271676a0598594762cc53e4f577337eb275313 (diff) | |
| download | Ishtar-93364489ab4e6daf16f924b2d8212f7fcdc5e477.tar.bz2 Ishtar-93364489ab4e6daf16f924b2d8212f7fcdc5e477.zip | |
Merge branch 'v0.9' into wheezy
Diffstat (limited to 'archaeological_operations/views.py')
| -rw-r--r-- | archaeological_operations/views.py | 69 |
1 files changed, 42 insertions, 27 deletions
diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py index c4e4acb5e..9b420f594 100644 --- a/archaeological_operations/views.py +++ b/archaeological_operations/views.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2010-2016 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2010-2017 É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 @@ -185,20 +185,29 @@ wizard_steps = [ ('final-operation_creation', FinalForm)] -def check_files_for_operation(self): - if not check_rights_condition(['view_file'])(self): - return False - return get_current_profile().files +def get_check_files_for_operation(other_check=None): + def func(self): + if not get_current_profile().files or \ + not check_rights_condition(['view_file'])(self): + return False + if not other_check: + return True + return other_check(self) + return func + +check_files_for_operation = get_check_files_for_operation() + ope_crea_condition_dict = { - 'filechoice-operation_creation': - check_files_for_operation, + 'filechoice-operation_creation': check_files_for_operation, 'preventive-operation_creation': - is_preventive('general-operation_creation', models.OperationType, - 'operation_type', 'prev_excavation'), + get_check_files_for_operation( + is_preventive('general-operation_creation', models.OperationType, + 'operation_type', 'prev_excavation')), 'preventivediag-operation_creation': - is_preventive('general-operation_creation', models.OperationType, - 'operation_type', 'arch_diagnostic'), + get_check_files_for_operation( + is_preventive('general-operation_creation', models.OperationType, + 'operation_type', 'arch_diagnostic')), 'townsgeneral-operation_creation': has_associated_file( 'filechoice-operation_creation', negate=True), 'towns-operation_creation': has_associated_file( @@ -232,25 +241,31 @@ operation_modif_wizard_steps = [ ('final-operation_modification', FinalForm) ] + +ope_modif_condition_dict = { + 'preventive-operation_modification': + get_check_files_for_operation( + is_preventive('general-operation_modification', models.OperationType, + 'operation_type', 'prev_excavation')), + 'preventivediag-operation_modification': + get_check_files_for_operation( + is_preventive('general-operation_modification', models.OperationType, + 'operation_type', 'arch_diagnostic')), + 'townsgeneral-operation_modification': has_associated_file( + 'general-operation_modification', negate=True), + 'towns-operation_modification': has_associated_file( + 'general-operation_modification'), + 'parcelsgeneral-operation_modification': has_associated_file( + 'general-operation_modification', negate=True), + 'parcels-operation_modification': has_associated_file( + 'general-operation_modification'), + +} + operation_modification_wizard = OperationModificationWizard.as_view( operation_modif_wizard_steps, label=_(u"Operation modification"), - condition_dict={ - 'preventive-operation_modification': is_preventive( - 'general-operation_modification', models.OperationType, - 'operation_type', 'prev_excavation'), - 'preventivediag-operation_modification': is_preventive( - 'general-operation_modification', models.OperationType, - 'operation_type', 'arch_diagnostic'), - 'townsgeneral-operation_modification': has_associated_file( - 'general-operation_modification', negate=True), - 'towns-operation_modification': has_associated_file( - 'general-operation_modification'), - 'parcelsgeneral-operation_modification': has_associated_file( - 'general-operation_modification', negate=True), - 'parcels-operation_modification': has_associated_file( - 'general-operation_modification'), -}, + condition_dict=ope_modif_condition_dict, url_name='operation_modification',) |
