Reputation: 1
I got a questions, in Django html templates file, I can use the {{ names }} to get a variable from the views.py via render_to_response(). However, how can I do something like this in the HTML templates:
{{% for name in names %}}
...
{{% endfor %}}
I tried to write like
{{% for name in {{ names }} %}}
of course it doesn't work.
anyone could help me on this? thanks.
Upvotes: 0
Views: 175
Reputation: 39709
You can iterate over list in a template like this:
{% for name in names %}
{{ name }}
{% endfor %}
Read more about the for template tag.
Upvotes: 1