Fix Python – How to put comments in Django templates?

Question

Asked By – Alex. S.

I would like to comment this with a line:

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



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

Now we will see solution for issue: How to put comments in Django templates?


Answer

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

This question is answered By – Van Gale

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0