diff --git a/accesspoc/accesspoc/settings.py b/accesspoc/accesspoc/settings.py index 6c8dd023..9b387a5d 100644 --- a/accesspoc/accesspoc/settings.py +++ b/accesspoc/accesspoc/settings.py @@ -9,6 +9,7 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ +from django.contrib.messages import constants as messages from django.utils.translation import gettext_lazy as _ from envparse import env @@ -141,6 +142,16 @@ USE_TZ = True +# Messages + +# Force cookie storage to reduce the possibility of looking the database +# when using SessionStorage, which saves the data in the database by default. +MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage' +# Fix mismatch with Bootstrap alert classes +MESSAGE_TAGS = { + messages.DEBUG: 'secondary', + messages.ERROR: 'danger', +} # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.11/howto/static-files/ diff --git a/accesspoc/templates/base.html b/accesspoc/templates/base.html index 9a302a00..d0725dba 100644 --- a/accesspoc/templates/base.html +++ b/accesspoc/templates/base.html @@ -73,6 +73,16 @@