konova/konova/contexts.py
mpeltriaux eda1c7a532 Public report enhancements
* adds toggling of scrollable box table views
* deactivates scrolling for public report view (so all entries can be seen if page is printed)
2022-12-12 13:09:17 +01:00

36 lines
1.1 KiB
Python

"""
Author: Michel Peltriaux
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
Contact: michel.peltriaux@sgdnord.rlp.de
Created on: 16.11.20
"""
from django.http import HttpRequest
from konova.sub_settings.context_settings import BASE_TITLE, HELP_LINK, BASE_FRONTEND_TITLE, TAB_TITLE_IDENTIFIER, \
IMPRESSUM_LINK
from konova.sub_settings.django_settings import EMAIL_REPLY_TO
class BaseContext:
"""
Holds all base data which is needed for every context rendering
"""
context = None
def __init__(self, request: HttpRequest, additional_context: dict = {}):
self.context = {
"base_title": BASE_TITLE,
TAB_TITLE_IDENTIFIER: BASE_FRONTEND_TITLE,
"language": request.LANGUAGE_CODE,
"user": request.user,
"current_role": None,
"help_link": HELP_LINK,
"impressum_link": IMPRESSUM_LINK,
"CONTACT_MAIL": EMAIL_REPLY_TO,
"tables_scrollable": True, # tables in boxes
}
# Add additional context, derived from given parameters
self.context.update(additional_context)