I’m using django messages and i want to put an hyperlink in it.
view.py:
from django.contrib import messages
def my_view(request):
messages.info(request,"My message with an <a href='/url'>hyperlink</a>")
Obviously, in my page, i see the html code and no hyperlink. How to treat the message as an htlml code ?
Hope this is clear.
Strings in Django templates are automatically escaped. You don’t want your raw HTML to be auto-escaped, so you should either pass the string to the
safefilter:or disable autoescape with the
autoescapetag: