Permalink
Browse files

Solves show_sub_menu by checking visible property in menus.templateta…

…gs.cut_after()
  • Loading branch information...
1 parent 91e1bd3 commit c12012a1333efb6cb1144c3a047c72c3c4ca7d3a @yakky yakky committed Feb 21, 2011
Showing with 8 additions and 1 deletion.
  1. +8 −1 menus/templatetags/menu_tags.py
@@ -22,8 +22,15 @@ def cut_after(node, levels, removed):
removed.extend(node.children)
node.children = []
else:
+ removed_local = []
for n in node.children:
- cut_after(n, levels - 1, removed)
+ if n.visible:
+ cut_after(n, levels - 1, removed)
+ else:
+ removed_local.append(n)
+ for n in removed_local:
+ node.children.remove(n)
+ removed.extend(removed_local)
def remove(node, removed):
removed.append(node)

0 comments on commit c12012a

Please sign in to comment.