pythonpython-3.xdjangodjango-templatesdjango-comments

How to put comments in Django templates?


I would like to comment this with a line:

{% if something.property %}
    <table>
        <tr>...



{% # this is a comment %}
{% if something.property %}
    <table>
        <tr>...

Solution

  • 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 #}