2022-08-19 08:27:42 +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
|
2022-08-22 10:58:07 +02:00
|
|
|
from django.utils.decorators import method_decorator
|
2022-08-19 08:27:42 +02:00
|
|
|
|
|
|
|
from compensation.models import EcoAccount
|
|
|
|
from konova.decorators import shared_access_required, default_group_required
|
2022-08-22 10:58:07 +02:00
|
|
|
from konova.views.share import AbstractShareByTokenView, AbstractShareFormView
|
2022-08-19 08:27:42 +02:00
|
|
|
|
|
|
|
|
2022-08-22 10:58:07 +02:00
|
|
|
class EcoAccountShareByTokenView(AbstractShareByTokenView):
|
|
|
|
model = EcoAccount
|
|
|
|
redirect_url = "compensation:acc:detail"
|
2022-08-19 08:27:42 +02:00
|
|
|
|
2022-08-22 10:58:07 +02:00
|
|
|
@method_decorator(login_required)
|
|
|
|
def dispatch(self, request, *args, **kwargs):
|
|
|
|
return super().dispatch(request, *args, **kwargs)
|
2022-08-19 08:27:42 +02:00
|
|
|
|
|
|
|
|
2022-08-22 10:58:07 +02:00
|
|
|
class EcoAccountShareFormView(AbstractShareFormView):
|
|
|
|
model = EcoAccount
|
2022-08-19 08:27:42 +02:00
|
|
|
|
2022-08-22 10:58:07 +02:00
|
|
|
@method_decorator(login_required)
|
|
|
|
@method_decorator(default_group_required)
|
|
|
|
@method_decorator(shared_access_required(EcoAccount, "id"))
|
|
|
|
def dispatch(self, request, *args, **kwargs):
|
|
|
|
return super().dispatch(request, *args, **kwargs)
|