Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I stop rendering variables in Django?

So,

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.

like image 582
Jakub Juszczak Avatar asked Nov 23 '15 19:11

Jakub Juszczak


Video Answer


1 Answers

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.

like image 82
Brian Avatar answered Oct 29 '22 02:10

Brian