konova/ema/views/document.py
mpeltriaux efb76278b4 # Document views refactoring
* refactors new, edit, get and delete views for eiv, kom, oek and ema
* introduces
2025-11-28 11:53:43 +01:00

46 lines
1.4 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 ema.forms import NewEmaDocumentModalForm, RemoveEmaDocumentModalForm, EditEmaDocumentModalForm
from ema.models import Ema, EmaDocument
from konova.views.document import AbstractEditDocumentView, AbstractRemoveDocumentView, AbstractGetDocumentView, \
AbstractNewDocumentView
class NewEmaDocumentView(AbstractNewDocumentView):
_MODEL_CLS = Ema
_FORM_CLS = NewEmaDocumentModalForm
_REDIRECT_URL = "ema:detail"
def _user_has_permission(self, user):
return user.is_ets_user()
class GetEmaDocumentView(AbstractGetDocumentView):
_MODEL_CLS = Ema
_DOCUMENT_CLS = EmaDocument
def _user_has_permission(self, user):
return user.is_ets_user()
class RemoveEmaDocumentView(AbstractRemoveDocumentView):
_MODEL_CLS = Ema
_DOCUMENT_CLS = EmaDocument
_FORM_CLS = RemoveEmaDocumentModalForm
_REDIRECT_URL = "ema:detail"
def _user_has_permission(self, user):
return user.is_ets_user()
class EditEmaDocumentView(AbstractEditDocumentView):
_MODEL_CLS = Ema
_FORM_CLS = EditEmaDocumentModalForm
_DOCUMENT_CLS = EmaDocument
_REDIRECT_URL = "ema:detail"
def _user_has_permission(self, user):
return user.is_ets_user()