mpeltriaux
a09fdae58c
* adds parcel displaying on public reports * fixes bug in EMA where autocomplete js would not load for modal forms * fixes bug where BaseContext cached data from last request and reused it, if not overwritten
32 lines
967 B
Python
32 lines
967 B
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
|
|
from konova.sub_settings.django_settings import LANGUAGE_CODE
|
|
|
|
|
|
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,
|
|
"base_frontend_title": BASE_FRONTEND_TITLE,
|
|
"language": request.LANGUAGE_CODE,
|
|
"user": request.user,
|
|
"current_role": None,
|
|
"help_link": HELP_LINK
|
|
}
|
|
|
|
# Add additional context, derived from given parameters
|
|
self.context.update(additional_context)
|