Hi I don't believe you can use variables within variables. What you can do is use/make a template tag that will look up in the list. Or you could make if forloop.counter == statements. Or you can make a dictionary and fx make the day_list keys And the table_list values and iterate over the key, value pair
~Jakob On Apr 4, 7:47 am, Travis <travis0...@gmail.com> wrote: > I am trying to use a 'dotted variable' (forloop.counter in this case) > as an index to a list, but without success so far. > > I have a list of strings called 'table_string' and the following code: > {% for d in day_list %} > <tr><td>{{d}}</td><td>{{table_string.forloop.counter}}</td></tr> > {% endfor %} > > What I'm trying to do is render the table_string item (indexed 1-7) > for the appropriate day using the forloop.counter variable, but I am > getting no result (or at least the TEMPLATE_STRING_IF_INVALID). > > Can someone please suggest what I need to do to use a variable > attribute as the attribute to another variable? > > Travis --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---