* adds AbstractRecordView to konova/views/record.py * implements for all major data types
42 lines
1.1 KiB
Python
42 lines
1.1 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.shortcuts import get_object_or_404, render
|
|
from django.views import View
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
from konova.contexts import BaseContext
|
|
|
|
|
|
class AbstractLogView(View):
|
|
model = None
|
|
|
|
class Meta:
|
|
abstract = True
|
|
|
|
def get(self, request, id: str):
|
|
""" Renders a log view using modal
|
|
|
|
Args:
|
|
request (HttpRequest): The incoming request
|
|
id (str): The object's id
|
|
|
|
Returns:
|
|
|
|
"""
|
|
intervention = get_object_or_404(self.model, id=id)
|
|
template = "modal/modal_generic.html"
|
|
body_template = "log.html"
|
|
|
|
context = {
|
|
"modal_body_template": body_template,
|
|
"log": intervention.log.all(),
|
|
"modal_title": _("Log"),
|
|
}
|
|
context = BaseContext(request, context).context
|
|
return render(request, template, context)
|