How to put comments in Django templates How to put comments in Django templates django django

How to put comments in Django templates


As answer by Miles, {% comment %}...{% endcomment %} is used for multi-line comments, but you can also comment out text on the same line like this:

{# some text #}


Comment tags are documented at https://docs.djangoproject.com/en/stable/ref/templates/builtins/#std:templatetag-comment

{% comment %} this is a comment {% endcomment %}

Single line comments are documented at https://docs.djangoproject.com/en/stable/topics/templates/#comments

{# this won't be rendered #}


Using the {# #} notation, like so:

{# Everything you see here is a comment. It won't show up in the HTML output. #}