variable

variable and escape

{{ name }}

Pongo2 will auto escape it if it contains html tags.

To turn it off, use:

{{ name|safe }}

or:

{% autoescape off %}
{{ name }}
{% endautoescape %}

Pongo2 will autoescape html, but it won't escape for javascript, to escape in JS code, use escapejs:

<script>
    let name = "{{ name|escapejs }}"
</script>

set variable

{% set new_var = "hello" %}
{{ new_var }}

use `with` to set variable

I'm bob

Last updated