From 79d20bb860c979f699a6d583493b0ef242e3615c Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Tue, 28 Nov 2017 13:50:43 +0100 Subject: [PATCH] added warning message in config.yaml --- context_processors.py | 3 +++ rowsandall_app/settings.py | 7 +++++++ templates/basebase.html | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/context_processors.py b/context_processors.py index 1d6a00d6..99b93001 100644 --- a/context_processors.py +++ b/context_processors.py @@ -18,3 +18,6 @@ def hello_world(request): return { 'helloworld': 'hi Sander' } + +def warning_message(request): + return {'WARNING_MESSAGE': settings.WARNING_MESSAGE} diff --git a/rowsandall_app/settings.py b/rowsandall_app/settings.py index f4cd50c5..c76969ca 100644 --- a/rowsandall_app/settings.py +++ b/rowsandall_app/settings.py @@ -117,6 +117,7 @@ TEMPLATES = [ 'django.contrib.messages.context_processors.messages', 'django.template.context_processors.i18n', 'context_processors.google_analytics', + 'context_processors.warning_message', ], # 'loaders': [ # 'django.template.loaders.app_directories.Loader', @@ -383,3 +384,9 @@ TWEET_ACCESS_TOKEN_SECRET = CFG['tweet_access_token_secret'] TWEET_CONSUMER_KEY = CFG['tweet_consumer_key'] TWEET_CONSUMER_SECRET = CFG['tweet_consumer_secret'] +# Environment + +try: + WARNING_MESSAGE = CFG['warning_message'] +except KeyError: + WARNING_MESSAGE = '' diff --git a/templates/basebase.html b/templates/basebase.html index ec85bb4f..deca65f2 100644 --- a/templates/basebase.html +++ b/templates/basebase.html @@ -202,6 +202,11 @@
+ {% if WARNING_MESSAGE != '' %} +

+ {{ WARNING_MESSAGE }} +

+ {% endif %} {% if messages %} {% for message in messages %} {% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %}