mpeltriaux
f49bb74c38
* adds new login_required_modal decorator * can be used before regular login_required decorator to return a proper session-timed-out message
50 lines
1.8 KiB
Python
50 lines
1.8 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.utils.decorators import method_decorator
|
|
|
|
from compensation.models import Compensation
|
|
from konova.decorators import shared_access_required, default_group_required, login_required_modal
|
|
from konova.views.deadline import AbstractRemoveDeadlineView, AbstractEditDeadlineView, AbstractNewDeadlineView
|
|
|
|
|
|
class NewCompensationDeadlineView(AbstractNewDeadlineView):
|
|
model = Compensation
|
|
redirect_url = "compensation:detail"
|
|
|
|
@method_decorator(login_required_modal)
|
|
@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)
|
|
|
|
|
|
class EditCompensationDeadlineView(AbstractEditDeadlineView):
|
|
model = Compensation
|
|
redirect_url = "compensation:detail"
|
|
|
|
@method_decorator(login_required_modal)
|
|
@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)
|
|
|
|
|
|
class RemoveCompensationDeadlineView(AbstractRemoveDeadlineView):
|
|
model = Compensation
|
|
redirect_url = "compensation:detail"
|
|
|
|
@method_decorator(login_required_modal)
|
|
@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)
|