On Wed, Mar 21, 2012 at 12:47 PM, Larry Martell <[email protected]> wrote: > This is probably a stupid newbie question .... > > I want to access a column of data in a row using forloop.counter, but > I cannot get it to work. > > In my test code, if I display {{ forloop.counter }} I get 2 > If I display {{ headers.0.2 }} I get ToolType > But if I display {{ headers.0.forloop.counter }} I get nothing > > What is the proper syntax for this? >
The preferred solution is to structure your data better in your view so that writing the template to render the data is straightforward. The pragmatic solution is to use a custom filter to access your current data structures: http://stackoverflow.com/questions/2024660/django-sort-dict-in-template Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" 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/django-users?hl=en.

