* adds generic modal rendering using package django-bootstrap-modal-forms * adds document file removing from hard drive * adds translations
35 lines
1.1 KiB
Python
35 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.settings import HELP_LINK
|
|
from konova.sub_settings.context_settings import BASE_TITLE, WIKI_URL, BASE_FRONTEND_TITLE
|
|
|
|
|
|
class BaseContext:
|
|
"""
|
|
Holds all base data which is needed for every context rendering
|
|
"""
|
|
context = {
|
|
"base_title": BASE_TITLE,
|
|
"base_frontend_title": BASE_FRONTEND_TITLE,
|
|
"language": "en",
|
|
"wiki_url": WIKI_URL,
|
|
"user": None,
|
|
"current_role": None,
|
|
"help_link": HELP_LINK,
|
|
"modal_reload_page": "true", # must be string and lower case true, since it's used in JS code
|
|
}
|
|
|
|
def __init__(self, request: HttpRequest, additional_context: dict = {}):
|
|
self.context["language"] = request.LANGUAGE_CODE
|
|
self.context["user"] = request.user
|
|
|
|
# Add additional context, derived from given parameters
|
|
self.context.update(additional_context)
|