From 35ebfbda5c0c2c862cc8e10b46c83545cb205178 Mon Sep 17 00:00:00 2001 From: Stephen Burrows Date: Fri, 28 Jan 2011 09:18:32 -0500 Subject: [PATCH] Added navigation key to shipherd's has_navigation filter. --- contrib/shipherd/templatetags/shipherd.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/shipherd/templatetags/shipherd.py b/contrib/shipherd/templatetags/shipherd.py index 97475fd..98e3e6b 100644 --- a/contrib/shipherd/templatetags/shipherd.py +++ b/contrib/shipherd/templatetags/shipherd.py @@ -83,7 +83,13 @@ def recursenavigation(parser, token): @register.filter -def has_navigation(node): # optional arg for a key? +def has_navigation(node, key=None): + nav = node.navigation + if key is not None: + if key in nav and bool(node.navigation[key]): + return True + elif key not in node.navigation: + return False return bool(node.navigation) -- 2.20.1