2006/1/8, Adrian Holovaty <holovaty(at)gmail.com>: > > On 1/8/06, aaloy <[EMAIL PROTECTED]> wrote: > > I'm trying to set the defaul value of a select box based on a > > parameter, I'm trying something like > > > > {% for item in items_list %} > > <option value="{{item.id}}" label="{{item.name}}" > > {% ifequal item.id session.id %} > > selected > > {% endifequal %} > > >{{item.name}}</option> > > {% endfor %} > > > > But it complains about non existent item.id. As far as I can see in > > the for documentation there is no way to get the actual value of the > > object, isn't it? In that case how could we do that sort of things? > > I'm not sure what you mean here...What's the exact error you get?
VariableDoesNotExist Exception Value: Failed lookup for key [item] in Exception Location: /usr/lib/python2.4/site-packages/Django-0.90-py2.4.egg/django/core/template/__init__.py in resolve_variable, line 674 But I have found the problem. I missunderstod the documentation. I have added an additional check to see if the session variable is set and now it's ok. Best regards, -- Antoni Aloy López Binissalem - Mallorca Soci de Bulma