diff options
Diffstat (limited to 'archaeological_operations/views.py')
-rw-r--r-- | archaeological_operations/views.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py index f15e24c43..7bbc4c0b4 100644 --- a/archaeological_operations/views.py +++ b/archaeological_operations/views.py @@ -584,6 +584,28 @@ def site_delete(request, pk): return redirect(reverse(wizard_url, kwargs={"step": "final-" + wizard_url})) +def site_add_top_operation(request, pks, current_right=None): + q = models.ArchaeologicalSite.objects.filter(pk=pks) + if not q.count(): + raise Http404() + site = q.all()[0] + if not site.can_do(request, "view_archaeologicalsite") \ + or not site.operations.count(): + raise Http404() + # operation add permission checked on view call + top_operation = site.create_or_update_top_operation(create=True) + if not wizard_is_available( + operation_modification_wizard, request, models.Operation, top_operation.pk + ): + return HttpResponseRedirect("/") + + wizard_url = "operation_modification" + wizards.OperationModificationWizard.session_set_value( + request, "selec-" + wizard_url, "pk", top_operation.pk, reset=True + ) + return redirect(reverse(wizard_url, kwargs={"step": "general-" + wizard_url})) + + operation_administrativeactop_search_wizard = wizards.SearchWizard.as_view( [ ( |