konova/intervention/views/resubmission.py
mpeltriaux 55a69d45c3 Intervention views
* splits intervention/views.py (+700 lines) into separate files in new module
    * view files can now be found in /intervention/views/...
2022-08-19 07:34:09 +02:00

40 lines
1.3 KiB
Python

"""
Author: Michel Peltriaux
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
Contact: ksp-servicestelle@sgdnord.rlp.de
Created on: 19.08.22
"""
from django.contrib.auth.decorators import login_required
from django.http import HttpRequest
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from intervention.models import Intervention
from konova.decorators import default_group_required, shared_access_required
from konova.forms.modals import ResubmissionModalForm
@login_required
@default_group_required
@shared_access_required(Intervention, "id")
def create_resubmission_view(request: HttpRequest, id: str):
""" Renders resubmission form for an intervention
Args:
request (HttpRequest): The incoming request
id (str): Intervention's id
Returns:
"""
intervention = get_object_or_404(Intervention, id=id)
form = ResubmissionModalForm(request.POST or None, instance=intervention, request=request)
form.action_url = reverse("intervention:resubmission-create", args=(id,))
return form.process_request(
request,
msg_success=_("Resubmission set"),
redirect_url=reverse("intervention:detail", args=(id,))
)