我试图证明我从数据库中获得的一些文本是正确的,但我还需要使用template-tag换行。
html:
<p class="justify">{{ article.contenu|linebreaks }}</p>css:
.justify
{
text-align: justify!important;
}我的文本不会自动对齐,除非我去掉换行符标签。
你知道如何同时使用justify和idea标签吗?
诚恳地
发布于 2021-01-18 20:10:10
使用此Django过滤器:
<p class="justify">{{ article.contenu|linebreaksbr }}</p>我希望这对你有帮助,谢谢。
发布于 2019-11-26 18:02:30
在模板中,你应该使用安全模板标签:
<p class="justify">{{ article.contenu|safe }}</p>如果您愿意,也可以在linebreaks之前使用safe:
<p class="justify">{{ article.contenu|safe|linebreaks }}</p>https://stackoverflow.com/questions/59048154
复制相似问题