mpeltriaux
9283c12162
* adds new login_required_modal decorator * can be used before regular login_required decorator to return a proper session-timed-out message
51 lines
1.8 KiB
Python
51 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 ema.models import Ema
|
|
from konova.decorators import conservation_office_group_required, shared_access_required, login_required_modal
|
|
from konova.views.state import AbstractNewCompensationStateView, AbstractEditCompensationStateView, \
|
|
AbstractRemoveCompensationStateView
|
|
|
|
|
|
class NewEmaStateView(AbstractNewCompensationStateView):
|
|
model = Ema
|
|
redirect_url = "ema:detail"
|
|
|
|
@method_decorator(login_required_modal)
|
|
@method_decorator(login_required)
|
|
@method_decorator(conservation_office_group_required)
|
|
@method_decorator(shared_access_required(Ema, "id"))
|
|
def dispatch(self, request, *args, **kwargs):
|
|
return super().dispatch(request, *args, **kwargs)
|
|
|
|
|
|
class EditEmaStateView(AbstractEditCompensationStateView):
|
|
model = Ema
|
|
redirect_url = "ema:detail"
|
|
|
|
@method_decorator(login_required_modal)
|
|
@method_decorator(login_required)
|
|
@method_decorator(conservation_office_group_required)
|
|
@method_decorator(shared_access_required(Ema, "id"))
|
|
def dispatch(self, request, *args, **kwargs):
|
|
return super().dispatch(request, *args, **kwargs)
|
|
|
|
|
|
class RemoveEmaStateView(AbstractRemoveCompensationStateView):
|
|
model = Ema
|
|
redirect_url = "ema:detail"
|
|
|
|
@method_decorator(login_required_modal)
|
|
@method_decorator(login_required)
|
|
@method_decorator(conservation_office_group_required)
|
|
@method_decorator(shared_access_required(Ema, "id"))
|
|
def dispatch(self, request, *args, **kwargs):
|
|
return super().dispatch(request, *args, **kwargs)
|