As far as I know, the tour_dict.tour approach does not work because "template variable dictionary lookups use arguments as strings not as variable names" ( http://code.djangoproject.com/ticket/1495 )
I use a solution like this: {% for tour in tourset %} {% for dict_item in tour_dict.items %} {% ifequal dict_item.0 tour.pk %} - now you have the dictionary item you're looking for This solution is not ideal as the template rendering operation involves looping through tour_dict for every tour - I think this adds a considerable time to the rendering process. regards, AO'R On Sep 25, 6:07 am, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 25-Sep-07, at 10:23 AM, Oleg Korsak wrote: > > > Hello! I have many `tour` objects as a key for a `tour_dict` > > dictionary. > > How can I access tour_dict values using tour? Like tour_dict[tour]... > > template will not work with [ ] > > how about tour_dict.tour? > > -- > > regards > kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---