Joseph Turian
Joseph Turian

Reputation: 16540

Literals in django template language?

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

{{Image.jpg|title}}

and I want that text to be output (not interpretated) in the HTML, how do I do so?

Upvotes: 0

Views: 691

Answers (2)

czarchaic
czarchaic

Reputation: 6318

Try the {% templatetag %} template tag

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

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

Upvotes: 5

Fragsworth
Fragsworth

Reputation: 35497

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.

Upvotes: 1

Related Questions