diff options
Diffstat (limited to 'archaeological_operations/views.py')
-rw-r--r-- | archaeological_operations/views.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py index 5299b7131..0b9b9c453 100644 --- a/archaeological_operations/views.py +++ b/archaeological_operations/views.py @@ -30,6 +30,7 @@ from ishtar_common.wizards import SearchWizard, check_rights_condition from ishtar_common.forms import ClosingDateFormSelection from ishtar_common.forms_common import AuthorFormset, TownFormset, \ SourceDeletionForm +from ishtar_common.models import get_current_profile from wizards import * from forms import * import models @@ -231,7 +232,9 @@ operation_search_wizard = SearchWizard.as_view([ url_name='operation_search',) wizard_steps = [ + ('filechoice-operation_creation', OperationFormFileChoice), ('general-operation_creation', OperationFormGeneral), + ('archaeologicalsite-operation_creation', ArchaeologicalSiteFormSet), ('preventive-operation_creation', OperationFormPreventive), ('preventivediag-operation_creation', OperationFormPreventiveDiag), ('townsgeneral-operation_creation', TownFormset), @@ -243,16 +246,19 @@ wizard_steps = [ ('relations-operation_creation', RecordRelationsFormSet), ('abstract-operation_creation', OperationFormAbstract), ('final-operation_creation', FinalForm)] -if FILES_AVAILABLE: - wizard_steps.insert(0, ('filechoice-operation_creation', - OperationFormFileChoice)) + + +def check_files_for_operation(self): + if not check_rights_condition(['view_file'])(self): + return False + return get_current_profile().files operation_creation_wizard = OperationWizard.as_view( wizard_steps, label=_(u"New operation"), condition_dict={ 'filechoice-operation_creation': - check_rights_condition(['view_file']), + check_files_for_operation, 'preventive-operation_creation': is_preventive('general-operation_creation', models.OperationType, 'operation_type', 'prev_excavation'), @@ -273,6 +279,7 @@ operation_creation_wizard = OperationWizard.as_view( operation_modification_wizard = OperationModificationWizard.as_view([ ('selec-operation_modification', OperationFormSelection), ('general-operation_modification', OperationFormModifGeneral), + ('archaeologicalsite-operation_modification', ArchaeologicalSiteFormSet), ('preventive-operation_modification', OperationFormPreventive), ('preventivediag-operation_modification', OperationFormPreventiveDiag), ('towns-operation_modification', SelectedTownFormset), |