* extends BaseModalFormView to hold general logic for processing GET and POST requests for BaseModalForm endpoints * refactors uuid check to use a specific parameter instead of kwargs * fixes css bug where modal form input elements would not be visible * refactors check view for intervention from function to class * refactors DeductionViews to inherit from extended BaseModalFormView
31 lines
1.0 KiB
Python
31 lines
1.0 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 django.contrib.auth.mixins import LoginRequiredMixin
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
from intervention.forms.modals.check import CheckModalForm
|
|
from intervention.models import Intervention
|
|
from konova.utils.message_templates import INTERVENTION_INVALID
|
|
from konova.views.base import BaseModalFormView
|
|
|
|
|
|
class InterventionCheckView(LoginRequiredMixin, BaseModalFormView):
|
|
_MODEL_CLS = Intervention
|
|
_FORM_CLS = CheckModalForm
|
|
_MSG_SUCCESS = _("Check performed")
|
|
_MSG_ERROR = INTERVENTION_INVALID
|
|
_REDIRECT_URL = "intervention:detail"
|
|
|
|
def _user_has_permission(self, user):
|
|
return user.is_zb_user()
|
|
|
|
def _get_redirect_url(self, *args, **kwargs):
|
|
redirect_url = super()._get_redirect_url(*args, **kwargs)
|
|
redirect_url += "#related_data"
|
|
return redirect_url
|