开发者

Literals in django template language?

If I want some text to appear literally in a Django template, e.g.

{{Image.jpg|title}}

and I wan开发者_如何学运维t that text to be output (not interpretated) in the HTML, how do I do so?


Try the {% templatetag %} template tag

{% templatetag openvariable %}Image.jpg|title{% templatetag closevariable %}

http://docs.djangoproject.com/en/dev/ref/templates/builtins/#templatetag


You could start it with an HTML entity. e.g.:

{{Image.jpg|title}}

However, I can only imagine this means you are writing content in your templates, which is normally not advisable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜