Awesome!!!!! I knew it had to be something small - many thanks! :)
On Mar 26, 4:12 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > remove the ',' > > {% ifequal nav.slugName current %} > > -Doug > > On Mar 26, 7:06 pm, "Mikey" <[EMAIL PROTECTED]> wrote: > > > Can someone tell me why the following template code always evaluates > > to true when comparing two strings: > > > <ul class="rollmenu"> > > {% for nav in nav_items %} > > {% ifequal nav.slugName, current %} > > <li class="selected"> > > <a href="/products/{{ nav.slugName }}/">{{ nav.displayName }}</ > > a> > > </li> > > {% else %} > > <li> > > <a href="/products/{{ nav.slugName }}/">{{ nav.displayName }}</ > > a> > > </li> > > {% endifequal %} > > {% endfor %} > > </ul> > > > if I stick the following debug code: > > > {{ nav.slugName }} -- {{ link }} > > > I get values that should not be equal and values that should > > > eg. > > nav.slugName = col1, link = col2 > > col1 col2 > > ------ ----- > > one -- one > > two -- one > > three -- one > > - the first item should evaluate to true, but the rest shouldn't, > > however the else never gets evaluated > > > I'm sure it's something simple :) > > > This code is in a template called from the following code: > > > register.inclusion_tag('left_nav.html')(show_leftnav) > > > And show_leftnav is: > > > def show_leftnav(current): > > left_nav_items = Manufacturer.objects.all().order_by('displayName') > > return {'nav_items' : left_nav_items, 'current' : current} > > > And finally, in the template.html: > > > {% block leftNavigation %} > > {% show_leftnav "home" %} > > {% endblock %} > > > for home page and: > > > {% block leftNavigation %} > > {% show_leftnav manufacturer.slugName %} > > {% endblock %} > > > for the product pages that the leftnav links to. > > > Hope someone can help, I'm also open to suggestions for a better way > > to do left navigation that "knows" where you are :) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---