相关疑难解决方法(0)

在django消息中放置<a>超链接

我正在使用django消息,我想在其中添加一个超链接.

view.py:

from django.contrib import messages

def my_view(request):
    messages.info(request,"My message with an <a href='/url'>hyperlink</a>")
Run Code Online (Sandbox Code Playgroud)

显然,在我的页面中,我看到了html代码,没有超链接.如何将消息视为htlml代码?

希望这很清楚.

django django-templates

18
推荐指数
3
解决办法
6528
查看次数

标签 统计

django ×1

django-templates ×1