Duke wrote:
They are looping over a list I am looking forfor (i = 0; i < 10; i++) { printf("Hello, World!); } link for looping statement
I am not aware of any tag that will allow you to do that, out of the box. You have two options, the first is to create a custom template tag that do what you want[1]. This shouldn't really be terribly difficult to do.
The second option would be to just pass in a variable into the context with a list containing the number of items of the number of times you want to loop. Using generic views, this could be done in your urls.py like:
...
('^$', 'direct_to_template',
{ 'template_name': 'homepage.html',
'extra_context': {'looper': range(10) }})
...
Then you can use the standard {% for %} tag:
{% for i in looper %}
{{i}}
{% endfor %}
[1]
http://www.djangoproject.com/documentation/templates_python/#extending-the-template-system
signature.asc
Description: OpenPGP digital signature

