I'm trying to display a bit of html in a message that's being displayed via the new Django messages framework. Specifically, I'm doing this via the ModelAdmin.message_user method, which is just a thin wrapper around messages():
def message_user(self, request, message):
"""
Send a message to the user. The default implementation
posts a message using the django.contrib.messages backend.
"""
messages.info(request, message)
Everything I've tried so far seems to display escaped HTML.
self.message_user(request, "<a href=\"http://www.google.com\">Here's google!</a>")
Doesn't work, nor does:
from django.utils.safestring import mark_safe
...
self.message_user(request, mark_safe("<a href=\"http://www.google.com\">Here's google!</a>"))
The display of the template code in the admin base.html template is pretty straightforward:
{% if messages %}
<ul class="messagelist">{% for message in messages %}<li>{{ message }}</li>{% endfor %}</ul>
{% endif %}
So I'm not exactly sure what I am doing wrong.
Thoughts or guidance greatly appreciated, thanks!