Ticket #20610: message-level-dict.patch

File message-level-dict.patch, 804 bytes (added by bmispelon, 2 years ago)
  • django/contrib/messages/context_processors.py

    diff --git a/django/contrib/messages/context_processors.py b/django/contrib/messages/context_processors.py
    index 26cbcd5..d30a4e0 100644
    a b  
    11from django.contrib.messages.api import get_messages
     2from django.contrib.messages import constants
    23
    34
    45def messages(request):
    56    """
    67    Returns a lazy 'messages' context variable.
    78    """
    8     return {'messages': get_messages(request)}
     9    return {
     10        'messages': get_messages(request),
     11        'MESSAGE_LEVELS': {
     12            'DEBUG': constants.DEBUG,
     13            'INFO': constants.INFO,
     14            'SUCCESS': constants.SUCCESS,
     15            'WARNING': constants.WARNING,
     16            'ERROR': constants.ERROR,
     17        }
     18}
Back to Top