Re: accessing an attribute for the first item in a template context

2008-07-17 Thread Tim Chase
>> example, I can do: >> >> {% for s in objectlist %} >> User name is: {{s.user_name}} >> {% endfor %} >> >> But, I can't do this: >> User name is: {{ objectlist.0.user_name }} What is "objectlist"? is it a list() or an iterable? It may be trying to index into an iterable. Thus you can eith

Re: accessing an attribute for the first item in a template context

2008-07-16 Thread Norman Harman
Hani wrote: > Hi, > > I'm a newbie and am having a an issue accessing the attribute for a > variable. I did a search (django documentation and here) and found > nothing. If this has been covered before, please direct me to the > correct thread. > > I currently pass a context to my template and

accessing an attribute for the first item in a template context

2008-07-16 Thread Hani
Hi, I'm a newbie and am having a an issue accessing the attribute for a variable. I did a search (django documentation and here) and found nothing. If this has been covered before, please direct me to the correct thread. I currently pass a context to my template and it works fine. For example,