You need to user {{ forloop.counter }}.
https://docs.djangoproject.com/en/1.2/ref/templates/builtins/#for

On Tue, Oct 18, 2011 at 9:02 AM, Max <[email protected]> wrote:
> Hi,
> I suppose for who knows it, this request is really easy. But It's making me
> crazy and I can't find documentation in the Django site (or I can't
> understand it).
> I'm building an array to be used in a javascript. I need the var "contatore"
> to be 0 then 1, 2, 3... I need to +1 each time starting by 0.
> Normally I have only to declare the var =0 out the for and the just var =
> var +1 inside the for. But in Django I can't understand which is the sybtax
> to do it.
> Please help, I need only this to close a project!!!!
> This is my code:
> {% for elemento in risultati %}
> indirizzi[{{ contatore }}]="{{ elemento.indirizzo }}, {{ elemento.citta }}
> {{ elemento.nazione }}";
> descrizioni[{{ contatore }}]="{{ elemento.nome }}";
> informazioni[{{ contatore }}]="Nome: {{ elemento.nome }} "
> {% endfor %}
>
> Max
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/yddhjx8qTvoJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to