About Escaping Curly Braces in Django Templates

The quickest way to escape opening or closing curly braces in Django template is probably to use this syntax:

{{ "{" }}{{ "{" }} username {{ "}" }}{{ "}" }}

When you have many of those cases to escape, use the {% verbatim %} template tag:

{% verbatim doc %}
{{ username }}
{% endverbatim doc %}

Tips and Tricks Programming Django 4.2 Django 3.2 Django 2.2