# BaseModalFormView refactoring
* 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
This commit is contained in:
@@ -8,19 +8,24 @@ Created on: 19.08.22
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
|
||||
from intervention.models import Intervention
|
||||
from konova.utils.message_templates import DEDUCTION_ADDED, DEDUCTION_EDITED, DEDUCTION_REMOVED
|
||||
from konova.views.deduction import AbstractNewDeductionView, AbstractEditDeductionView, AbstractRemoveDeductionView
|
||||
|
||||
_INTERVENTION_DETAIL_URL_NAME = "intervention:detail"
|
||||
|
||||
class NewInterventionDeductionView(LoginRequiredMixin, AbstractNewDeductionView):
|
||||
_MODEL = Intervention
|
||||
_REDIRECT_URL = "intervention:detail"
|
||||
_MODEL_CLS = Intervention
|
||||
_MSG_SUCCESS = DEDUCTION_ADDED
|
||||
_REDIRECT_URL = _INTERVENTION_DETAIL_URL_NAME
|
||||
|
||||
|
||||
class EditInterventionDeductionView(LoginRequiredMixin, AbstractEditDeductionView):
|
||||
_MODEL = Intervention
|
||||
_REDIRECT_URL = "intervention:detail"
|
||||
_MODEL_CLS = Intervention
|
||||
_MSG_SUCCESS = DEDUCTION_EDITED
|
||||
_REDIRECT_URL = _INTERVENTION_DETAIL_URL_NAME
|
||||
|
||||
|
||||
class RemoveInterventionDeductionView(LoginRequiredMixin, AbstractRemoveDeductionView):
|
||||
_MODEL = Intervention
|
||||
_REDIRECT_URL = "intervention:detail"
|
||||
_MODEL_CLS = Intervention
|
||||
_MSG_SUCCESS = DEDUCTION_REMOVED
|
||||
_REDIRECT_URL = _INTERVENTION_DETAIL_URL_NAME
|
||||
|
||||
Reference in New Issue
Block a user