-2

When i do a simple code in django, its just shows me the next messege:

Could not parse the remainder: '[0,1,2]' from '[0,1,2]'

And there is the code:

                    {% for i in [0,1,2] %}
                        <div class="coverw-block-welcome">
                        </div>
                    {% endfor %}

The smae thing if i do "range". For some reason django dont let me using "for loop". Its a problem with django

1 Answers1

1

Django template language is not Python, it does not support lists.

In your case, you can loop over the characters of a string:

{% for i in "012" %}
Alasdair
  • 298,606
  • 55
  • 578
  • 516