using pages_dynamic_tree_menu with django 1.3

23 views
Skip to first unread message

Stupot

unread,
Aug 19, 2011, 6:21:04 PM8/19/11
to django-page-cms
Hi,

I'm trying to create a nice site navigation using the template tag:
pages_dynamic_tree_menu in a django 1.3 project, but I get an error;

Caught VariableDoesNotExist while rendering: Failed lookup for key
[url] in u .....

I added the old version of the template tag code;

----------------------------------------------------------------------------------

def pages_dynamic_tree_menu_old(context, page, url='/'):
"""
render a "dynamic" tree menu, with all nodes expanded which are
either
ancestors or the current page itself.
"""
request = context['request']
site_id = None
children = None
if 'current_page' in context:
current_page = context['current_page']
# if this node is expanded, we also have to render its
children
# a node is expanded if it is the current node or one of its
ancestors
if page.lft <= current_page.lft and page.rght >=
current_page.rght:
children = page.get_children_for_frontend()
return locals()

pages_dynamic_tree_menu_old = register.inclusion_tag('pages/
dynamic_tree_menu.html',
takes_context=True)
(pages_dynamic_tree_menu_old)

----------------------------------------------------------------------------------


...and this seems to work for now.

Anybody any tips on how to go about fixing?




Reply all
Reply to author
Forward
0 new messages