2022-08-19 08:12:32 +02:00
|
|
|
"""
|
|
|
|
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
|
2022-08-22 08:38:23 +02:00
|
|
|
from django.utils.decorators import method_decorator
|
2022-08-19 08:12:32 +02:00
|
|
|
|
|
|
|
from compensation.forms.modals.compensation_action import RemoveCompensationActionModalForm, \
|
|
|
|
EditCompensationActionModalForm, NewCompensationActionModalForm
|
|
|
|
from compensation.models import Compensation, CompensationAction
|
2022-08-25 11:34:09 +02:00
|
|
|
from konova.decorators import shared_access_required, default_group_required, login_required_modal
|
2022-08-19 08:12:32 +02:00
|
|
|
from konova.utils.message_templates import COMPENSATION_ACTION_REMOVED, COMPENSATION_ACTION_EDITED, \
|
|
|
|
COMPENSATION_ACTION_ADDED
|
2022-08-22 08:38:23 +02:00
|
|
|
from konova.views.action import AbstractNewCompensationActionView, AbstractEditCompensationActionView, \
|
|
|
|
AbstractRemoveCompensationActionView
|
2022-08-19 08:12:32 +02:00
|
|
|
|
|
|
|
|
2022-08-22 08:38:23 +02:00
|
|
|
class NewCompensationActionView(AbstractNewCompensationActionView):
|
|
|
|
model = Compensation
|
|
|
|
redirect_url = "compensation:detail"
|
2022-08-19 08:12:32 +02:00
|
|
|
|
2022-08-25 11:34:09 +02:00
|
|
|
@method_decorator(login_required_modal)
|
2022-08-22 08:38:23 +02:00
|
|
|
@method_decorator(login_required)
|
|
|
|
@method_decorator(default_group_required)
|
|
|
|
@method_decorator(shared_access_required(Compensation, "id"))
|
|
|
|
def dispatch(self, request, *args, **kwargs):
|
|
|
|
return super().dispatch(request, *args, **kwargs)
|
2022-08-19 08:12:32 +02:00
|
|
|
|
|
|
|
|
2022-08-22 08:38:23 +02:00
|
|
|
class EditCompensationActionView(AbstractEditCompensationActionView):
|
|
|
|
model = Compensation
|
|
|
|
redirect_url = "compensation:detail"
|
2022-08-19 08:12:32 +02:00
|
|
|
|
2022-08-25 11:34:09 +02:00
|
|
|
@method_decorator(login_required_modal)
|
2022-08-22 08:38:23 +02:00
|
|
|
@method_decorator(login_required)
|
|
|
|
@method_decorator(default_group_required)
|
|
|
|
@method_decorator(shared_access_required(Compensation, "id"))
|
|
|
|
def dispatch(self, request, *args, **kwargs):
|
|
|
|
return super().dispatch(request, *args, **kwargs)
|
2022-08-19 08:12:32 +02:00
|
|
|
|
|
|
|
|
2022-08-22 08:38:23 +02:00
|
|
|
class RemoveCompensationActionView(AbstractRemoveCompensationActionView):
|
|
|
|
model = Compensation
|
|
|
|
redirect_url = "compensation:detail"
|
2022-08-19 08:12:32 +02:00
|
|
|
|
2022-08-25 11:34:09 +02:00
|
|
|
@method_decorator(login_required_modal)
|
2022-08-22 08:38:23 +02:00
|
|
|
@method_decorator(login_required)
|
|
|
|
@method_decorator(default_group_required)
|
|
|
|
@method_decorator(shared_access_required(Compensation, "id"))
|
|
|
|
def dispatch(self, request, *args, **kwargs):
|
|
|
|
return super().dispatch(request, *args, **kwargs)
|