Building a list in Django templates
django, django-templates
Solution
You can do it via cunning use of the `make_list` filter, but it's probably a bad idea:
{% for o in "123"|make_list %}
<div class="{% cycle 'row1' 'row2' %}">
{% cycle 'row1' 'row2' %}
</div>
{% endfor %}
p.s. You don't seem to be using `o` anywhere, so I'm not sure what you're trying to do.
Problem
With this code: ``` {% for o in [1,2,3] %} <div class="{% cycle 'row1' 'row2' %}"> {% cycle 'row1' 'row2' %} </div> {% endfor %} ``` I get a `TemplateSyntaxError`: ``` Could not parse the remainder: '[1,2,3]' from '[1,2,3]' ``` Is there a way of building a list in a template?