104_Class_based_views #200
@ -13,7 +13,8 @@ from compensation.views.compensation.resubmission import CompensationResubmissio
|
||||
from compensation.views.compensation.report import report_view
|
||||
from compensation.views.compensation.deadline import NewCompensationDeadlineView, EditCompensationDeadlineView, \
|
||||
RemoveCompensationDeadlineView
|
||||
from compensation.views.compensation.action import action_edit_view, action_new_view, action_remove_view
|
||||
from compensation.views.compensation.action import NewCompensationActionView, EditCompensationActionView, \
|
||||
RemoveCompensationActionView
|
||||
from compensation.views.compensation.state import NewCompensationStateView, EditCompensationStateView, \
|
||||
RemoveCompensationStateView
|
||||
from compensation.views.compensation.compensation import index_view, new_view, new_id_view, detail_view, edit_view, \
|
||||
@ -35,9 +36,9 @@ urlpatterns = [
|
||||
path('<id>/state/<state_id>/edit', EditCompensationStateView.as_view(), name='state-edit'),
|
||||
path('<id>/state/<state_id>/remove', RemoveCompensationStateView.as_view(), name='state-remove'),
|
||||
|
||||
path('<id>/action/new', action_new_view, name='new-action'),
|
||||
path('<id>/action/<action_id>/edit', action_edit_view, name='action-edit'),
|
||||
path('<id>/action/<action_id>/remove', action_remove_view, name='action-remove'),
|
||||
path('<id>/action/new', NewCompensationActionView.as_view(), name='new-action'),
|
||||
path('<id>/action/<action_id>/edit', EditCompensationActionView.as_view(), name='action-edit'),
|
||||
path('<id>/action/<action_id>/remove', RemoveCompensationActionView.as_view(), name='action-remove'),
|
||||
|
||||
path('<id>/deadline/new', NewCompensationDeadlineView.as_view(), name="new-deadline"),
|
||||
path('<id>/deadline/<deadline_id>/edit', EditCompensationDeadlineView.as_view(), name='deadline-edit'),
|
||||
|
@ -16,7 +16,8 @@ from compensation.views.eco_account.report import report_view
|
||||
from compensation.views.eco_account.resubmission import EcoAccountResubmissionView
|
||||
from compensation.views.eco_account.state import NewEcoAccountStateView, EditEcoAccountStateView, \
|
||||
RemoveEcoAccountStateView
|
||||
from compensation.views.eco_account.action import action_edit_view, action_new_view, action_remove_view
|
||||
from compensation.views.eco_account.action import NewEcoAccountActionView, EditEcoAccountActionView, \
|
||||
RemoveEcoAccountActionView
|
||||
from compensation.views.eco_account.deadline import NewEcoAccountDeadlineView, EditEcoAccountDeadlineView, \
|
||||
RemoveEcoAccountDeadlineView
|
||||
from compensation.views.eco_account.share import share_view, create_share_view
|
||||
@ -41,9 +42,9 @@ urlpatterns = [
|
||||
path('<id>/state/<state_id>/edit', EditEcoAccountStateView.as_view(), name='state-edit'),
|
||||
path('<id>/state/<state_id>/remove', RemoveEcoAccountStateView.as_view(), name='state-remove'),
|
||||
|
||||
path('<id>/action/new', action_new_view, name='new-action'),
|
||||
path('<id>/action/<action_id>/edit', action_edit_view, name='action-edit'),
|
||||
path('<id>/action/<action_id>/remove', action_remove_view, name='action-remove'),
|
||||
path('<id>/action/new', NewEcoAccountActionView.as_view(), name='new-action'),
|
||||
path('<id>/action/<action_id>/edit', EditEcoAccountActionView.as_view(), name='action-edit'),
|
||||
path('<id>/action/<action_id>/remove', RemoveEcoAccountActionView.as_view(), name='action-remove'),
|
||||
|
||||
path('<id>/deadline/new', NewEcoAccountDeadlineView.as_view(), name="new-deadline"),
|
||||
path('<id>/deadline/<deadline_id>/edit', EditEcoAccountDeadlineView.as_view(), name='deadline-edit'),
|
||||
|
@ -9,6 +9,7 @@ from django.contrib.auth.decorators import login_required
|
||||
from django.http import HttpRequest
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse
|
||||
from django.utils.decorators import method_decorator
|
||||
|
||||
from compensation.forms.modals.compensation_action import RemoveCompensationActionModalForm, \
|
||||
EditCompensationActionModalForm, NewCompensationActionModalForm
|
||||
@ -16,74 +17,38 @@ from compensation.models import Compensation, CompensationAction
|
||||
from konova.decorators import shared_access_required, default_group_required
|
||||
from konova.utils.message_templates import COMPENSATION_ACTION_REMOVED, COMPENSATION_ACTION_EDITED, \
|
||||
COMPENSATION_ACTION_ADDED
|
||||
from konova.views.action import AbstractNewCompensationActionView, AbstractEditCompensationActionView, \
|
||||
AbstractRemoveCompensationActionView
|
||||
|
||||
|
||||
@login_required
|
||||
@default_group_required
|
||||
@shared_access_required(Compensation, "id")
|
||||
def action_new_view(request: HttpRequest, id: str):
|
||||
""" Renders a form for adding new actions for a compensation
|
||||
class NewCompensationActionView(AbstractNewCompensationActionView):
|
||||
model = Compensation
|
||||
redirect_url = "compensation:detail"
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
id (str): The compensation's id to which the new state will be related
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
comp = get_object_or_404(Compensation, id=id)
|
||||
form = NewCompensationActionModalForm(request.POST or None, instance=comp, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=COMPENSATION_ACTION_ADDED,
|
||||
redirect_url=reverse("compensation:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
@method_decorator(login_required)
|
||||
@method_decorator(default_group_required)
|
||||
@method_decorator(shared_access_required(Compensation, "id"))
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
|
||||
@login_required
|
||||
@default_group_required
|
||||
@shared_access_required(Compensation, "id")
|
||||
def action_edit_view(request: HttpRequest, id: str, action_id: str):
|
||||
""" Renders a form for editing actions for a compensation
|
||||
class EditCompensationActionView(AbstractEditCompensationActionView):
|
||||
model = Compensation
|
||||
redirect_url = "compensation:detail"
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
id (str): The compensation's id
|
||||
action_id (str): The action's id
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
comp = get_object_or_404(Compensation, id=id)
|
||||
action = get_object_or_404(CompensationAction, id=action_id)
|
||||
form = EditCompensationActionModalForm(request.POST or None, instance=comp, action=action, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=COMPENSATION_ACTION_EDITED,
|
||||
redirect_url=reverse("compensation:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
@method_decorator(login_required)
|
||||
@method_decorator(default_group_required)
|
||||
@method_decorator(shared_access_required(Compensation, "id"))
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
|
||||
@login_required
|
||||
@default_group_required
|
||||
@shared_access_required(Compensation, "id")
|
||||
def action_remove_view(request: HttpRequest, id: str, action_id: str):
|
||||
""" Renders a form for removing a compensation action
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
id (str): The compensation's id
|
||||
id (str): The action's id
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
comp = get_object_or_404(Compensation, id=id)
|
||||
action = get_object_or_404(CompensationAction, id=action_id)
|
||||
form = RemoveCompensationActionModalForm(request.POST or None, instance=comp, action=action, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=COMPENSATION_ACTION_REMOVED,
|
||||
redirect_url=reverse("compensation:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
class RemoveCompensationActionView(AbstractRemoveCompensationActionView):
|
||||
model = Compensation
|
||||
redirect_url = "compensation:detail"
|
||||
|
||||
@method_decorator(login_required)
|
||||
@method_decorator(default_group_required)
|
||||
@method_decorator(shared_access_required(Compensation, "id"))
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
@ -6,84 +6,42 @@ Created on: 19.08.22
|
||||
|
||||
"""
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.http import HttpRequest
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse
|
||||
from django.utils.decorators import method_decorator
|
||||
|
||||
from compensation.forms.modals.compensation_action import EditCompensationActionModalForm, \
|
||||
RemoveCompensationActionModalForm, NewCompensationActionModalForm
|
||||
from compensation.models import EcoAccount, CompensationAction
|
||||
from compensation.models import EcoAccount
|
||||
from konova.decorators import shared_access_required, default_group_required
|
||||
from konova.utils.message_templates import COMPENSATION_ACTION_EDITED, COMPENSATION_ACTION_REMOVED, \
|
||||
COMPENSATION_ACTION_ADDED
|
||||
from konova.views.action import AbstractNewCompensationActionView, AbstractEditCompensationActionView, \
|
||||
AbstractRemoveCompensationActionView
|
||||
|
||||
|
||||
@login_required
|
||||
@default_group_required
|
||||
@shared_access_required(EcoAccount, "id")
|
||||
def action_new_view(request: HttpRequest, id: str):
|
||||
""" Renders a form for adding new actions for an eco account
|
||||
class NewEcoAccountActionView(AbstractNewCompensationActionView):
|
||||
model = EcoAccount
|
||||
redirect_url = "compensation:acc:detail"
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
id (str): The account's id to which the new state will be related
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
acc = get_object_or_404(EcoAccount, id=id)
|
||||
form = NewCompensationActionModalForm(request.POST or None, instance=acc, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=COMPENSATION_ACTION_ADDED,
|
||||
redirect_url=reverse("compensation:acc:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
@method_decorator(login_required)
|
||||
@method_decorator(default_group_required)
|
||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
|
||||
@login_required
|
||||
@default_group_required
|
||||
@shared_access_required(EcoAccount, "id")
|
||||
def action_remove_view(request: HttpRequest, id: str, action_id: str):
|
||||
""" Renders a form for removing a compensation action
|
||||
class EditEcoAccountActionView(AbstractEditCompensationActionView):
|
||||
model = EcoAccount
|
||||
redirect_url = "compensation:acc:detail"
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
id (str): The compensation's id
|
||||
id (str): The action's id
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
acc = get_object_or_404(EcoAccount, id=id)
|
||||
action = get_object_or_404(CompensationAction, id=action_id)
|
||||
form = RemoveCompensationActionModalForm(request.POST or None, instance=acc, action=action, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=COMPENSATION_ACTION_REMOVED,
|
||||
redirect_url=reverse("compensation:acc:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
@method_decorator(login_required)
|
||||
@method_decorator(default_group_required)
|
||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
|
||||
@login_required
|
||||
@default_group_required
|
||||
@shared_access_required(EcoAccount, "id")
|
||||
def action_edit_view(request: HttpRequest, id: str, action_id: str):
|
||||
""" Renders a form for editing a compensation action
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
id (str): The compensation's id
|
||||
id (str): The action's id
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
acc = get_object_or_404(EcoAccount, id=id)
|
||||
action = get_object_or_404(CompensationAction, id=action_id)
|
||||
form = EditCompensationActionModalForm(request.POST or None, instance=acc, action=action, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=COMPENSATION_ACTION_EDITED,
|
||||
redirect_url=reverse("compensation:acc:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
class RemoveEcoAccountActionView(AbstractRemoveCompensationActionView):
|
||||
model = EcoAccount
|
||||
redirect_url = "compensation:acc:detail"
|
||||
|
||||
@method_decorator(login_required)
|
||||
@method_decorator(default_group_required)
|
||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
@ -7,7 +7,7 @@ Created on: 19.08.21
|
||||
"""
|
||||
from django.urls import path
|
||||
|
||||
from ema.views.action import action_new_view, action_edit_view, action_remove_view
|
||||
from ema.views.action import NewEmaActionView, EditEmaActionView, RemoveEmaActionView
|
||||
from ema.views.deadline import NewEmaDeadlineView, EditEmaDeadlineView, RemoveEmaDeadlineView
|
||||
from ema.views.document import NewEmaDocumentView, EditEmaDocumentView, RemoveEmaDocumentView, GetEmaDocumentView
|
||||
from ema.views.ema import index_view, new_view, new_id_view, detail_view, edit_view, remove_view
|
||||
@ -35,9 +35,9 @@ urlpatterns = [
|
||||
path('<id>/state/<state_id>/remove', RemoveEmaStateView.as_view(), name='state-remove'),
|
||||
path('<id>/state/<state_id>/edit', EditEmaStateView.as_view(), name='state-edit'),
|
||||
|
||||
path('<id>/action/new', action_new_view, name='new-action'),
|
||||
path('<id>/action/<action_id>/edit', action_edit_view, name='action-edit'),
|
||||
path('<id>/action/<action_id>/remove', action_remove_view, name='action-remove'),
|
||||
path('<id>/action/new', NewEmaActionView.as_view(), name='new-action'),
|
||||
path('<id>/action/<action_id>/edit', EditEmaActionView.as_view(), name='action-edit'),
|
||||
path('<id>/action/<action_id>/remove', RemoveEmaActionView.as_view(), name='action-remove'),
|
||||
|
||||
path('<id>/deadline/new', NewEmaDeadlineView.as_view(), name="new-deadline"),
|
||||
path('<id>/deadline/<deadline_id>/edit', EditEmaDeadlineView.as_view(), name='deadline-edit'),
|
||||
|
@ -6,84 +6,42 @@ Created on: 19.08.22
|
||||
|
||||
"""
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.http import HttpRequest
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse
|
||||
from django.utils.decorators import method_decorator
|
||||
|
||||
from compensation.forms.modals.compensation_action import RemoveCompensationActionModalForm, \
|
||||
EditCompensationActionModalForm, NewCompensationActionModalForm
|
||||
from compensation.models import CompensationAction
|
||||
from ema.models import Ema
|
||||
from konova.decorators import shared_access_required, conservation_office_group_required
|
||||
from konova.utils.message_templates import COMPENSATION_ACTION_REMOVED, COMPENSATION_ACTION_EDITED, \
|
||||
COMPENSATION_ACTION_ADDED
|
||||
from konova.views.action import AbstractNewCompensationActionView, AbstractEditCompensationActionView, \
|
||||
AbstractRemoveCompensationActionView
|
||||
|
||||
|
||||
@login_required
|
||||
@conservation_office_group_required
|
||||
@shared_access_required(Ema, "id")
|
||||
def action_new_view(request: HttpRequest, id: str):
|
||||
""" Renders a form for adding new actions for an EMA
|
||||
class NewEmaActionView(AbstractNewCompensationActionView):
|
||||
model = Ema
|
||||
redirect_url = "ema:detail"
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
id (str): The EMA's id to which the new state will be related
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
ema = get_object_or_404(Ema, id=id)
|
||||
form = NewCompensationActionModalForm(request.POST or None, instance=ema, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=COMPENSATION_ACTION_ADDED,
|
||||
redirect_url=reverse("ema:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
@method_decorator(login_required)
|
||||
@method_decorator(conservation_office_group_required)
|
||||
@method_decorator(shared_access_required(Ema, "id"))
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
|
||||
@login_required
|
||||
@conservation_office_group_required
|
||||
@shared_access_required(Ema, "id")
|
||||
def action_edit_view(request: HttpRequest, id: str, action_id: str):
|
||||
""" Renders a form for editing an actions for an EMA
|
||||
class EditEmaActionView(AbstractEditCompensationActionView):
|
||||
model = Ema
|
||||
redirect_url = "ema:detail"
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
id (str): The EMA's id
|
||||
action_id (str): The action id
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
ema = get_object_or_404(Ema, id=id)
|
||||
action = get_object_or_404(CompensationAction, id=action_id)
|
||||
form = EditCompensationActionModalForm(request.POST or None, instance=ema, action=action, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=COMPENSATION_ACTION_EDITED,
|
||||
redirect_url=reverse("ema:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
@method_decorator(login_required)
|
||||
@method_decorator(conservation_office_group_required)
|
||||
@method_decorator(shared_access_required(Ema, "id"))
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
|
||||
@login_required
|
||||
@conservation_office_group_required
|
||||
@shared_access_required(Ema, "id")
|
||||
def action_remove_view(request: HttpRequest, id: str, action_id: str):
|
||||
""" Renders a form for removing an EMA action
|
||||
class RemoveEmaActionView(AbstractRemoveCompensationActionView):
|
||||
model = Ema
|
||||
redirect_url = "ema:detail"
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
id (str): The ema id
|
||||
id (str): The action's id
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
ema = get_object_or_404(Ema, id=id)
|
||||
action = get_object_or_404(CompensationAction, id=action_id)
|
||||
form = RemoveCompensationActionModalForm(request.POST or None, instance=ema, action=action, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=COMPENSATION_ACTION_REMOVED,
|
||||
redirect_url=reverse("ema:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
@method_decorator(login_required)
|
||||
@method_decorator(conservation_office_group_required)
|
||||
@method_decorator(shared_access_required(Ema, "id"))
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
108
konova/views/action.py
Normal file
108
konova/views/action.py
Normal file
@ -0,0 +1,108 @@
|
||||
"""
|
||||
Author: Michel Peltriaux
|
||||
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
||||
Contact: ksp-servicestelle@sgdnord.rlp.de
|
||||
Created on: 22.08.22
|
||||
|
||||
"""
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse
|
||||
from django.views import View
|
||||
|
||||
from compensation.forms.modals.compensation_action import NewCompensationActionModalForm, \
|
||||
EditCompensationActionModalForm, RemoveCompensationActionModalForm
|
||||
from compensation.models import CompensationAction
|
||||
from konova.utils.message_templates import COMPENSATION_STATE_ADDED, COMPENSATION_STATE_EDITED, \
|
||||
COMPENSATION_STATE_REMOVED
|
||||
|
||||
|
||||
class AbstractCompensationActionView(View):
|
||||
model = None
|
||||
redirect_url = None
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
|
||||
class AbstractNewCompensationActionView(AbstractCompensationActionView):
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
def get(self, request, id: str):
|
||||
""" Renders a form for adding new actions
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
id (str): The object's id to which the new action will be related
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
obj = get_object_or_404(self.model, id=id)
|
||||
form = NewCompensationActionModalForm(request.POST or None, instance=obj, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=COMPENSATION_STATE_ADDED,
|
||||
redirect_url=reverse(self.redirect_url, args=(id,)) + "#related_data"
|
||||
)
|
||||
|
||||
def post(self, request, id: str):
|
||||
return self.get(request, id)
|
||||
|
||||
|
||||
class AbstractEditCompensationActionView(AbstractCompensationActionView):
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
def get(self, request, id: str, action_id: str):
|
||||
""" Renders a form for editing a action
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
id (str): The object id
|
||||
action_id (str): The action's id
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
obj = get_object_or_404(self.model, id=id)
|
||||
action = get_object_or_404(CompensationAction, id=action_id)
|
||||
form = EditCompensationActionModalForm(request.POST or None, instance=obj, action=action, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=COMPENSATION_STATE_EDITED,
|
||||
redirect_url=reverse(self.redirect_url, args=(id,)) + "#related_data"
|
||||
)
|
||||
|
||||
def post(self, request, id: str, action_id: str):
|
||||
return self.get(request, id, action_id)
|
||||
|
||||
|
||||
class AbstractRemoveCompensationActionView(AbstractCompensationActionView):
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
def get(self, request, id: str, action_id: str):
|
||||
""" Renders a form for removing aaction
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
id (str): The object id
|
||||
action_id (str): The action's id
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
obj = get_object_or_404(self.model, id=id)
|
||||
action = get_object_or_404(CompensationAction, id=action_id)
|
||||
form = RemoveCompensationActionModalForm(request.POST or None, instance=obj, action=action, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=COMPENSATION_STATE_REMOVED,
|
||||
redirect_url=reverse(self.redirect_url, args=(id,)) + "#related_data"
|
||||
)
|
||||
|
||||
def post(self, request, id: str, action_id: str):
|
||||
return self.get(request, id, action_id)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user