我正在使用django-haystack。在haystack提供的高亮显示中,我如何在结果中呈现标签或striptag。
{% for text in result.highlighted.text %}
<blockquote>{% highlight text with query %}</blockquote>
{% endfor %}我需要这样做:
{% for text in result.highlighted.text %}
<blockquote>{% highlight text|striptags with query %}</blockquote>
{% endfor %}但是这不起作用,请提出一些建议。提前谢谢你。
发布于 2012-02-10 09:29:32
如下所示:
{% for text in result.highlighted.text %}
<blockquote>
{% with text|striptags as stripped_text %}
{% highlight stripped_text with query %}
{% endwith %}
</blockquote>
{% endfor %}https://docs.djangoproject.com/en/def/ref/templates/builtins/#with
https://stackoverflow.com/questions/8993381
复制相似问题