How do I output HTML in a message in the new Django messages framework?

后端 未结 8 1071
花落未央
花落未央 2020-12-04 21:37

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_use

相关标签:
8条回答
  • 2020-12-04 22:08

    As noted in the following Django ticket, it should work if you use mark_safe() in combination with the SessionStorage backend: https://code.djangoproject.com/ticket/14976#comment:9

    0 讨论(0)
  • 2020-12-04 22:12

    I was looking for a way to use unescaped HTML in an admin listing. Not sure if this applies to the messages framework, but using allow_tags as described here helped me.

    http://urlencode.blogspot.com/2009/10/neat-django-admin-tricks-part-1.html

    0 讨论(0)
提交回复
热议问题