Permalink
Browse files

Added a has_childen helper to page objects in the page menus.

  • Loading branch information...
1 parent 4877fc1 commit 82f4e65200ee58f827b8440743d13e4972078ea1 @stephenmcd stephenmcd committed Jul 16, 2011
Showing with 2 additions and 0 deletions.
  1. +2 −0 mezzanine/pages/templatetags/pages_tags.py
@@ -47,8 +47,10 @@ def page_menu(context, token):
except KeyError:
user = None
slug = ""
+ has_children = lambda page_id: lambda: page_id in context["menu_pages"]
for page in Page.objects.published(for_user=user).select_related(depth=2).order_by("_order"):
page.set_menu_helpers(slug)
+ setattr(page, "has_children", has_children(page.id))
pages[page.parent_id].append(page)
context["menu_pages"] = pages
context["on_home"] = slug == reverse("home")

0 comments on commit 82f4e65

Please sign in to comment.