Possible Duplicate:
how to create counter loop in django template?
I want to print some data based on some condition,
I want to use it like we used in other languages:
for(i=1;i<=count;i++)
print i
To do this in django I wrote
{% for i in count %}
<p>{{ i }}</p>
{% endfor %}
but it gives me an error 'int' object is not iterable.Count is coming from views.py and if I prints the count alone than it shows the output.
I wanted to print some value until count not becomes zero,So how i can do this in django.
And one more thing can we use while loop in django because i also try to use it for this task but it gives me the error of invalid block tag: 'while'
So please let me know how can I do this task ?
Thanks
Edit in my view.py I have used like this
count=Product_attributes.objects.count()
and then pass this count to my template