Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

verbatim Template Tag


Example

Output Django code without execute it:

{% verbatim %}
  {% for x in fruits %}
    <p>{{ x }}</p>
  {% endfor %}
{% endverbatim %}
Run Example »

Definition and Usage

The verbatim tag is used to stop Django from executing code.

Anything between {% verbatim %} and {% endverbatim %} will not be executed, but rendered as output instead.

To be sure that you refer to the correct verbatim code block, you can add a name to it:

Example

When there can be more than one verbatim tag in a code block, use the name argument to specify which one you mean:

{% verbatim mycode%}
  {% for x in fruits %}
    {% verbatim %}
       <p>{{ x }}</p>
    {% endverbatim %}
  {% endfor %}
{% endverbatim mycode%}
Run Example »

Syntax

{% verbatim name %}
...
{% endverbatim %}

Parameters

Value Description
name Optional. The name of the verbatim block.