擅长:python、mysql、java
<p>您有3个选项来剥离html代码:</p>
<p>在模板中使用“<a href="https://docs.djangoproject.com/en/dev/ref/templates/builtins/#safe" rel="nofollow">safe</a>”筛选器:</p>
<pre><code>{{ object.name|safe }}
</code></pre>
<p>在模板中使用“<a href="https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#autoescape" rel="nofollow">autoescape</a>”标记:</p>
^{pr2}$
<p>或者在python代码中声明为“<a href="https://docs.djangoproject.com/en/dev/ref/utils/#django.utils.safestring.mark_safe" rel="nofollow">safe</a>”:</p>
<pre><code>from django.utils.safestring import mark_safe
name = mark_safe(name)
</code></pre>