# 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:
@@ -11,10 +11,11 @@ from django.http import Http404
|
||||
from compensation.models import EcoAccount
|
||||
from konova.views.deduction import AbstractNewDeductionView, AbstractEditDeductionView, AbstractRemoveDeductionView
|
||||
|
||||
_ECO_ACCOUNT_DETAIl_URL_NAME = "compensation:acc:detail"
|
||||
|
||||
class NewEcoAccountDeductionView(LoginRequiredMixin, AbstractNewDeductionView):
|
||||
_MODEL = EcoAccount
|
||||
_REDIRECT_URL = "compensation:acc:detail"
|
||||
_MODEL_CLS = EcoAccount
|
||||
_REDIRECT_URL = _ECO_ACCOUNT_DETAIl_URL_NAME
|
||||
|
||||
def _custom_check(self, obj):
|
||||
# New deductions can only be created if the eco account has been recorded
|
||||
@@ -23,10 +24,10 @@ class NewEcoAccountDeductionView(LoginRequiredMixin, AbstractNewDeductionView):
|
||||
|
||||
|
||||
class EditEcoAccountDeductionView(LoginRequiredMixin, AbstractEditDeductionView):
|
||||
_MODEL = EcoAccount
|
||||
_REDIRECT_URL = "compensation:acc:detail"
|
||||
_MODEL_CLS = EcoAccount
|
||||
_REDIRECT_URL = _ECO_ACCOUNT_DETAIl_URL_NAME
|
||||
|
||||
|
||||
class RemoveEcoAccountDeductionView(LoginRequiredMixin, AbstractRemoveDeductionView):
|
||||
_MODEL = EcoAccount
|
||||
_REDIRECT_URL = "compensation:acc:detail"
|
||||
_MODEL_CLS = EcoAccount
|
||||
_REDIRECT_URL = _ECO_ACCOUNT_DETAIl_URL_NAME
|
||||
|
||||
Reference in New Issue
Block a user