如何在bootstrap_alert中放置链接?

时间:2018-08-28 16:12:29

标签: django django-bootstrap3 django-bootstrap4

如何在bootstrap_alert中放置一个链接?

msg=mark_safe('Please visit our forum site <a href="talk.edgle.com" class="alert-link">Edgle Talk</a> as well!')

render_alert(msg)
'<div class="alert alert-info alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Please visit our forum site &lt;a href=&quot;talk.edgle.com&quot; class=&quot;alert-link&quot;&gt;Edgle Talk&lt;/a&gt; as well!</div>'

如所见,由于以下函数调用链,html元素被转义:

bootstrap_alert-> render_alert-> render_tag-> format_html-> conditional_escape

0 个答案:

没有答案