我希望我的用户能够编写,例如image1并使用正则表达式来识别并用标签替换它。我拥有了一切工作 - 但是当我把数据传送到模板显示我这样做是这样的:django render从views.py传递的html标签
<div class="container">
<p>
{% articleTxt %}
</p>
</div>
ArticleTxt包含:
This is a test Article <img src="/media/articleImages/django-allauth.png">
and that was a picture and this is another one then some more text ----
original: This is a test Article *image1* and that was a picture and this is
another one *image2* then some more text
那是我的无奈。我试着改变模板:
{% autoescape off %} {{articleTXT}} {{% autoescape %}}
我也试过
{{% articleTXT|safe %}}
它总是打印标签,而不是使它们的。无论如何,将标记嵌入从view.py传递到我的模板!
我不理解'articleTXT'中的whats什么?它的'img'或'text' – Bijoy