Hasu Kimchi Hasu Kimchi - 9 months ago 62
Python Question

Can I stop rendering variables in Django?


can I somehow stop django rendering specific template variables?

Background is, that I wanted to try vuejs in a django app,
which kind of worked.

Problem is, both share the same syntax for variables.

So in vuejs you declare them like

{{ message }}

And djangos template engine interprete it as a django template variable and try to render it. Because it doenst exist, it disappear and vuejs isnt working anymore.


According to Vue's docs, its template tag delimiters can be changed to something else, like {!! !!}, if you want.

If that is not an option, Django has a {% verbatim %} tag that can escape parts of your template containing Vuejs tags.