Am 18.01.2011 um 14:53 schrieb GD:

> 
> Hi everyone,
>     Is there a way to do simple loop counter manipulation within the
> template? I.e something along the lines of:
> 
> {% for x in a %}
>      loop number = {{forloop.counter +1}}
> {% endfor %}
> 
> with the intention of
> 
> 2
> 3
> 4
> ....
> 
> as output. I realise the above doesn't work, but is there any scope
> for this sort of thing within the templating language itself?
> 


http://docs.djangoproject.com/en/dev/ref/templates/builtins/

look for 'forloop.counter'

good luck,
TR



> Regards,
> G
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to