43 lines
1.2 KiB
Python
43 lines
1.2 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 HttpRequest
|
||
|
from django.shortcuts import get_object_or_404, render
|
||
|
from django.utils.translation import gettext_lazy as _
|
||
|
|
||
|
from compensation.models import EcoAccount
|
||
|
from konova.contexts import BaseContext
|
||
|
from konova.decorators import shared_access_required, default_group_required
|
||
|
|
||
|
|
||
|
@login_required
|
||
|
@default_group_required
|
||
|
@shared_access_required(EcoAccount, "id")
|
||
|
def log_view(request: HttpRequest, id: str):
|
||
|
""" Renders a log view using modal
|
||
|
|
||
|
Args:
|
||
|
request (HttpRequest): The incoming request
|
||
|
id (str): The eco acount's id
|
||
|
|
||
|
Returns:
|
||
|
|
||
|
"""
|
||
|
comp = get_object_or_404(EcoAccount, id=id)
|
||
|
template = "modal/modal_generic.html"
|
||
|
body_template = "log.html"
|
||
|
|
||
|
context = {
|
||
|
"modal_body_template": body_template,
|
||
|
"log": comp.log.all(),
|
||
|
"modal_title": _("Log"),
|
||
|
}
|
||
|
context = BaseContext(request, context).context
|
||
|
return render(request, template, context)
|
||
|
|