2022-08-19 07:51:49 +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 07:52:22 +02:00
|
|
|
from django.utils.decorators import method_decorator
|
2022-08-19 07:51:49 +02:00
|
|
|
|
|
|
|
from ema.forms import NewEmaDocumentModalForm
|
|
|
|
from ema.models import Ema, EmaDocument
|
|
|
|
from konova.decorators import shared_access_required, conservation_office_group_required
|
|
|
|
from konova.forms.modals import EditDocumentModalForm
|
2022-08-22 07:52:22 +02:00
|
|
|
from konova.views.document import AbstractEditDocumentView, AbstractRemoveDocumentView, AbstractGetDocumentView, \
|
|
|
|
AbstractNewDocumentView
|
2022-08-19 07:51:49 +02:00
|
|
|
|
|
|
|
|
2022-08-22 07:52:22 +02:00
|
|
|
class NewEmaDocumentView(AbstractNewDocumentView):
|
|
|
|
model = Ema
|
|
|
|
form = NewEmaDocumentModalForm
|
|
|
|
redirect_url = "ema:detail"
|
2022-08-19 07:51:49 +02:00
|
|
|
|
2022-08-22 07:52:22 +02:00
|
|
|
@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)
|
2022-08-19 07:51:49 +02:00
|
|
|
|
|
|
|
|
2022-08-22 07:52:22 +02:00
|
|
|
class GetEmaDocumentView(AbstractGetDocumentView):
|
|
|
|
model = Ema
|
|
|
|
document_model = EmaDocument
|
2022-08-19 07:51:49 +02:00
|
|
|
|
2022-08-22 07:52:22 +02:00
|
|
|
@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)
|
2022-08-19 07:51:49 +02:00
|
|
|
|
|
|
|
|
2022-08-22 07:52:22 +02:00
|
|
|
class RemoveEmaDocumentView(AbstractRemoveDocumentView):
|
|
|
|
model = Ema
|
|
|
|
document_model = EmaDocument
|
2022-08-19 07:51:49 +02:00
|
|
|
|
2022-08-22 07:52:22 +02:00
|
|
|
@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)
|
2022-08-19 07:51:49 +02:00
|
|
|
|
|
|
|
|
2022-08-22 07:52:22 +02:00
|
|
|
class EditEmaDocumentView(AbstractEditDocumentView):
|
|
|
|
model = Ema
|
|
|
|
document_model = EmaDocument
|
|
|
|
form = EditDocumentModalForm
|
|
|
|
redirect_url = "ema:detail"
|
2022-08-19 07:51:49 +02:00
|
|
|
|
2022-08-22 07:52:22 +02:00
|
|
|
@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)
|