[Answered ]-Rename reference to Django messages in templates?

2👍

Messages isn’t a template tag but a template context variable provided by the "django.contrib.messages.context_processors.messages" processor. I think the best way to rename it is simply replacing django’s context processor with your own version, e.g:

from django.contrib.messages.api import get_messages

def messages(request):
    """
    Returns a lazy 'messages' context variable.
    """
    return {'your_name_space': get_messages(request)}

Leave a comment