Hi, What is 'divs' in your example? And what do you want to do it?
If you want to display a list "name1", "name2", "name3" you can do it in this way: view.py divs = ('name1', 'name2', 'name3') template.html {% for div in divs %} <td>{{ div }}</td> {% endfor %} Regards, Marcin On Feb 6, 5:23 pm, [EMAIL PROTECTED] wrote: > Hi guys, > > Trying to figure out how to use the forloop.counter in a template but > to add it to a field to increment the name of the field each time. for > example.. in my template i will have this > > {% for div in divs %} > <td>{{ form.name }}</td> > {% endfor %} > > so this will result in ... > > name > name > name etc.. > > I need it to be name1, name2 , name3 > > I was thinking of something like this although this does not work. is > there a way of using the %s %i in a template? > > {% for div in divs %} > <td>{{ form.name|forloop.counter }}</td> > {% endfor %} > > If i just did it manualy like below it works fine > > {% for div in divs %} > <input type="text" name="name{{ forloop.counter }}" /> > {% endfor %} > > Any help would be greatly appreciated. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---