mpeltriaux
a16f68012d
* splits compensation/views/eco_account.py (+700 lines) into separate files in new module * view files can now be found in /compensation/views/eco_account/...
56 lines
1.7 KiB
Python
56 lines
1.7 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.decorators import login_required
|
|
from django.http import Http404
|
|
from django.utils.decorators import method_decorator
|
|
|
|
from compensation.models import EcoAccount
|
|
from konova.decorators import default_group_required
|
|
from konova.views.deduction import AbstractNewDeductionView, AbstractEditDeductionView, AbstractRemoveDeductionView
|
|
|
|
|
|
class NewEcoAccountDeductionView(AbstractNewDeductionView):
|
|
model = EcoAccount
|
|
redirect_url = "compensation:acc:detail"
|
|
|
|
@method_decorator(login_required)
|
|
@method_decorator(default_group_required)
|
|
def dispatch(self, request, *args, **kwargs):
|
|
return super().dispatch(request, *args, **kwargs)
|
|
|
|
def _custom_check(self, obj):
|
|
if not obj.recorded:
|
|
raise Http404()
|
|
|
|
|
|
class EditEcoAccountDeductionView(AbstractEditDeductionView):
|
|
def _custom_check(self, obj):
|
|
pass
|
|
|
|
model = EcoAccount
|
|
redirect_url = "compensation:acc:detail"
|
|
|
|
@method_decorator(login_required)
|
|
@method_decorator(default_group_required)
|
|
def dispatch(self, request, *args, **kwargs):
|
|
return super().dispatch(request, *args, **kwargs)
|
|
|
|
|
|
class RemoveEcoAccountDeductionView(AbstractRemoveDeductionView):
|
|
def _custom_check(self, obj):
|
|
pass
|
|
|
|
model = EcoAccount
|
|
redirect_url = "compensation:acc:detail"
|
|
|
|
@method_decorator(login_required)
|
|
@method_decorator(default_group_required)
|
|
def dispatch(self, request, *args, **kwargs):
|
|
return super().dispatch(request, *args, **kwargs)
|
|
|