In my situation, what I wanted to do was limit the display of a bunch of menu items depending on the group of the user. I accomplished this with a for loop and a test for a group:
{% for group in user.get_list %} {% ifequal group 'desired_group' %} [...] It's a two-step process rather than one, but it gets the job done. That being said, should the menu evaluation go in a view rather than the template? To me it sounds logical to keep the menu in the template, but what do the more experienced django developers have to say? Thanks! -berto. On 2/11/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > On 2/11/06, Luke Skibinski Holt <[EMAIL PROTECTED]> wrote: > > > > > Would it be possible for me to use this function within a template > > > {% if user.is_member_of:"blah" %} > > > > I think calling functions with parameters from within a template was > > deliberately not included for security and simplicity reasons. > > The biggest reason for this isn't security or simplicity - it is to > prevent view logic from slipping into the template. Django templates > are deliberately 'simple' to prevent template writers from embedding > view logic in the template. > > If a complex logical operation required is required, it must be a > representation of some larger abstract concept. Evaluate the condition > in the view, and pass it in to the template as a context variable. > That way, if the logical condition describing the abstract concept > ever changes, you don't have to modify the template - just the view > logic that evaluates the context variable. > > Russ Magee %-) >