The verbatim template tag
We have seen that when using React, we can use JSX interpolation values in Django templates. This is because JSX uses single braces to interpolate values, and Django uses double braces. It should work fine as long as there are spaces between the JSX and Django braces.
Other frameworks, such as Vue, also use double braces for variable interpolation. What that means is if you had a Vue component’s HTML in your template, you might try to interpolate a value like this:
<h1>Hello, {{ name }}!</h1>
Of course, when Django renders the template, it will interpolate the name
value before the Vue framework gets a chance to render.
We can use the verbatim
template tag to have Django output the data exactly as it appears in the template without performing any rendering or variable interpolation. Using it with the previous example is simple, as shown here:
{% verbatim %} <h1>Hello, {{ name }}!</h1> {% endverbatim %}
Now when...