2022-08-19 08:27:42 +02:00
|
|
|
"""
|
|
|
|
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.decorators import login_required
|
2022-08-22 10:17:49 +02:00
|
|
|
from django.http import Http404
|
|
|
|
from django.utils.decorators import method_decorator
|
2022-08-19 08:27:42 +02:00
|
|
|
|
|
|
|
from compensation.models import EcoAccount
|
2022-08-25 11:34:09 +02:00
|
|
|
from konova.decorators import default_group_required, login_required_modal
|
2022-08-22 10:17:49 +02:00
|
|
|
from konova.views.deduction import AbstractNewDeductionView, AbstractEditDeductionView, AbstractRemoveDeductionView
|
2022-08-19 08:27:42 +02:00
|
|
|
|
|
|
|
|
2022-08-22 10:17:49 +02:00
|
|
|
class NewEcoAccountDeductionView(AbstractNewDeductionView):
|
|
|
|
model = EcoAccount
|
|
|
|
redirect_url = "compensation:acc:detail"
|
2022-08-19 08:27:42 +02:00
|
|
|
|
2022-08-25 11:34:09 +02:00
|
|
|
@method_decorator(login_required_modal)
|
2022-08-22 10:17:49 +02:00
|
|
|
@method_decorator(login_required)
|
|
|
|
@method_decorator(default_group_required)
|
|
|
|
def dispatch(self, request, *args, **kwargs):
|
|
|
|
return super().dispatch(request, *args, **kwargs)
|
2022-08-19 08:27:42 +02:00
|
|
|
|
2022-08-22 10:17:49 +02:00
|
|
|
def _custom_check(self, obj):
|
|
|
|
if not obj.recorded:
|
|
|
|
raise Http404()
|
2022-08-19 08:27:42 +02:00
|
|
|
|
|
|
|
|
2022-08-22 10:17:49 +02:00
|
|
|
class EditEcoAccountDeductionView(AbstractEditDeductionView):
|
|
|
|
def _custom_check(self, obj):
|
|
|
|
pass
|
2022-08-19 08:27:42 +02:00
|
|
|
|
2022-08-22 10:17:49 +02:00
|
|
|
model = EcoAccount
|
|
|
|
redirect_url = "compensation:acc:detail"
|
2022-08-19 08:27:42 +02:00
|
|
|
|
2022-08-25 11:34:09 +02:00
|
|
|
@method_decorator(login_required_modal)
|
2022-08-22 10:17:49 +02:00
|
|
|
@method_decorator(login_required)
|
|
|
|
@method_decorator(default_group_required)
|
|
|
|
def dispatch(self, request, *args, **kwargs):
|
|
|
|
return super().dispatch(request, *args, **kwargs)
|
2022-08-19 08:27:42 +02:00
|
|
|
|
|
|
|
|
2022-08-22 10:17:49 +02:00
|
|
|
class RemoveEcoAccountDeductionView(AbstractRemoveDeductionView):
|
|
|
|
def _custom_check(self, obj):
|
|
|
|
pass
|
2022-08-19 08:27:42 +02:00
|
|
|
|
2022-08-22 10:17:49 +02:00
|
|
|
model = EcoAccount
|
|
|
|
redirect_url = "compensation:acc:detail"
|
2022-08-19 08:27:42 +02:00
|
|
|
|
2022-08-25 11:34:09 +02:00
|
|
|
@method_decorator(login_required_modal)
|
2022-08-22 10:17:49 +02:00
|
|
|
@method_decorator(login_required)
|
|
|
|
@method_decorator(default_group_required)
|
|
|
|
def dispatch(self, request, *args, **kwargs):
|
|
|
|
return super().dispatch(request, *args, **kwargs)
|
2022-08-19 08:27:42 +02:00
|
|
|
|