704137216f
* adds linking to submenus * adds PaymentAdmin * adds Meta class inheritance for tables
111 lines
2.2 KiB
Python
111 lines
2.2 KiB
Python
from django.contrib.auth.decorators import login_required
|
|
from django.http import HttpRequest
|
|
from django.shortcuts import render
|
|
|
|
from compensation.models import Compensation, EcoAccount
|
|
from compensation.tables import CompensationTable, EcoAccountTable
|
|
from konova.contexts import BaseContext
|
|
from konova.decorators import *
|
|
|
|
|
|
@login_required
|
|
def index_view(request: HttpRequest):
|
|
"""
|
|
Renders the index view for compensation
|
|
|
|
Args:
|
|
request (HttpRequest): The incoming request
|
|
|
|
Returns:
|
|
A rendered view
|
|
"""
|
|
template = "generic_index.html"
|
|
user = request.user
|
|
compensations = Compensation.objects.filter(
|
|
deleted_on=None,
|
|
)
|
|
table = CompensationTable(
|
|
request=request,
|
|
queryset=compensations
|
|
)
|
|
context = {
|
|
"table": table,
|
|
}
|
|
context = BaseContext(request, context).context
|
|
return render(request, template, context)
|
|
|
|
|
|
@login_required
|
|
def new_view(request: HttpRequest):
|
|
# ToDo
|
|
pass
|
|
|
|
|
|
@login_required
|
|
def edit_view(request: HttpRequest, id: str):
|
|
# ToDo
|
|
pass
|
|
|
|
|
|
@login_required
|
|
def open_view(request: HttpRequest, id: str):
|
|
# ToDo
|
|
pass
|
|
|
|
|
|
@login_required
|
|
def remove_view(request: HttpRequest, id: str):
|
|
# ToDo
|
|
pass
|
|
|
|
|
|
@login_required
|
|
def account_index_view(request: HttpRequest):
|
|
"""
|
|
Renders the index view for eco accounts
|
|
|
|
Args:
|
|
request (HttpRequest): The incoming request
|
|
|
|
Returns:
|
|
A rendered view
|
|
"""
|
|
template = "generic_index.html"
|
|
user = request.user
|
|
eco_accounts = EcoAccount.objects.filter(
|
|
deleted_on=None,
|
|
)
|
|
table = EcoAccountTable(
|
|
request=request,
|
|
queryset=eco_accounts
|
|
)
|
|
context = {
|
|
"table": table,
|
|
}
|
|
context = BaseContext(request, context).context
|
|
return render(request, template, context)
|
|
|
|
|
|
@login_required
|
|
def account_new_view(request: HttpRequest):
|
|
# ToDo
|
|
pass
|
|
|
|
|
|
@login_required
|
|
def account_edit_view(request: HttpRequest, id: str):
|
|
# ToDo
|
|
pass
|
|
|
|
|
|
@login_required
|
|
def account_open_view(request: HttpRequest, id: str):
|
|
# ToDo
|
|
pass
|
|
|
|
|
|
@login_required
|
|
def account_remove_view(request: HttpRequest, id: str):
|
|
# ToDo
|
|
pass
|