From 9fde42a69a56cb6c8cdfd67b07c67a1b97638f12 Mon Sep 17 00:00:00 2001 From: Baptiste Mispelon Date: Mon, 28 Oct 2013 21:52:11 +0100 Subject: Fixed #20610: Added a message level dict to contrib.message context processor. --- docs/ref/contrib/messages.txt | 16 ++++++++++++++++ docs/releases/1.7.txt | 3 +++ 2 files changed, 19 insertions(+) (limited to 'docs') diff --git a/docs/ref/contrib/messages.txt b/docs/ref/contrib/messages.txt index c1995b6d39..caf51d26cc 100644 --- a/docs/ref/contrib/messages.txt +++ b/docs/ref/contrib/messages.txt @@ -196,6 +196,22 @@ Even if you know there is only just one message, you should still iterate over the ``messages`` sequence, because otherwise the message storage will not be cleared for the next request. +.. versionadded:: 1.7 + +The context processor also provides a ``DEFAULT_MESSAGE_LEVELS`` variable which +is a mapping of the message level names to their numeric value:: + + {% if messages %} + + {% endif %} + Creating custom message levels ------------------------------ diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt index 13db17cbd4..784ee86493 100644 --- a/docs/releases/1.7.txt +++ b/docs/releases/1.7.txt @@ -203,6 +203,9 @@ Minor features follow the :setting:`SESSION_COOKIE_SECURE` and :setting:`SESSION_COOKIE_HTTPONLY` settings. +* The :ref:`messages context processor ` now adds a + dictionary of default levels under the name ``DEFAULT_MESSAGE_LEVELS``. + :mod:`django.contrib.redirects` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- cgit v1.3