* refactors AbstractCompensationActionViews (new, edit, remove) to inherit from BaseModalFormView * refactors KOM, OEK, EMA views for compensation actions * moves message template strings into message_templates.py
29 lines
829 B
Python
29 lines
829 B
Python
"""
|
|
Author: Michel Peltriaux
|
|
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
|
Contact: ksp-servicestelle@sgdnord.rlp.de
|
|
Created on: 19.08.22
|
|
|
|
"""
|
|
from konova.forms.modals import RecordModalForm
|
|
from konova.utils.message_templates import ENTRY_RECORDED, ENTRY_UNRECORDED
|
|
from konova.views.base import BaseModalFormView
|
|
|
|
|
|
class AbstractRecordView(BaseModalFormView):
|
|
_MODEL_CLS = None
|
|
_FORM_CLS = RecordModalForm
|
|
_MSG_SUCCESS = None
|
|
|
|
def _user_has_permission(self, user):
|
|
return user.is_ets_user()
|
|
|
|
def _get_msg_success(self, *args, **kwargs):
|
|
obj = kwargs.get("obj")
|
|
assert obj is not None
|
|
|
|
if obj.is_recorded:
|
|
return ENTRY_RECORDED.format(obj.identifier)
|
|
else:
|
|
return ENTRY_UNRECORDED.format(obj.identifier)
|