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
|
|
|
|
from django.http import HttpRequest
|
|
|
|
from django.shortcuts import get_object_or_404
|
|
|
|
from django.urls import reverse
|
2022-08-22 07:52:22 +02:00
|
|
|
from django.utils.decorators import method_decorator
|
2022-08-19 08:27:42 +02:00
|
|
|
|
|
|
|
from compensation.forms.modals.document import NewEcoAccountDocumentModalForm
|
|
|
|
from compensation.models import EcoAccount, EcoAccountDocument
|
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:27:42 +02:00
|
|
|
from konova.forms.modals import EditDocumentModalForm
|
2022-08-22 07:52:22 +02:00
|
|
|
from konova.views.document import AbstractNewDocumentView, AbstractGetDocumentView, AbstractRemoveDocumentView, \
|
|
|
|
AbstractEditDocumentView
|
2022-08-19 08:27:42 +02:00
|
|
|
|
|
|
|
|
2022-08-22 07:52:22 +02:00
|
|
|
class NewEcoAccountDocumentView(AbstractNewDocumentView):
|
|
|
|
model = EcoAccount
|
|
|
|
form = NewEcoAccountDocumentModalForm
|
|
|
|
redirect_url = "compensation:acc:detail"
|
2022-08-19 08:27:42 +02:00
|
|
|
|
2022-08-25 11:34:09 +02:00
|
|
|
@method_decorator(login_required_modal)
|
2022-08-22 07:52:22 +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)
|
2022-08-19 08:27:42 +02:00
|
|
|
|
|
|
|
|
2022-08-22 07:52:22 +02:00
|
|
|
class GetEcoAccountDocumentView(AbstractGetDocumentView):
|
|
|
|
model = EcoAccount
|
|
|
|
document_model = EcoAccountDocument
|
2022-08-19 08:27:42 +02:00
|
|
|
|
2022-08-22 07:52:22 +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)
|
2022-08-19 08:27:42 +02:00
|
|
|
|
|
|
|
|
2022-08-22 07:52:22 +02:00
|
|
|
class RemoveEcoAccountDocumentView(AbstractRemoveDocumentView):
|
|
|
|
model = EcoAccount
|
|
|
|
document_model = EcoAccountDocument
|
2022-08-19 08:27:42 +02:00
|
|
|
|
2022-08-25 11:34:09 +02:00
|
|
|
@method_decorator(login_required_modal)
|
2022-08-22 07:52:22 +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)
|
2022-08-19 08:27:42 +02:00
|
|
|
|
|
|
|
|
2022-08-22 07:52:22 +02:00
|
|
|
class EditEcoAccountDocumentView(AbstractEditDocumentView):
|
|
|
|
model = EcoAccount
|
|
|
|
document_model = EcoAccountDocument
|
|
|
|
form = EditDocumentModalForm
|
|
|
|
redirect_url = "compensation:acc:detail"
|
2022-08-19 08:27:42 +02:00
|
|
|
|
2022-08-25 11:34:09 +02:00
|
|
|
@method_decorator(login_required_modal)
|
2022-08-22 07:52:22 +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)
|