@register.assignment_tag(takes_context=True)
def page_is_active(context, page, feincms_page=None, path=None):
 if isinstance(page, PagePretender):
  if (path is None):
   path = context[u'request'].path_info
  return path.startswith(page.get_absolute_url())
 else:
  if (feincms_page is None):
   feincms_page = context[u'feincms_page']
  return page.is_ancestor_of(feincms_page, include_self=True)

@ register . assignment_tag ( takes_context = True ) def page_is_active ( context , page , feincms_page = None , path = None ) : if isinstance ( page , PagePretender ) : if ( path is None ) : path = context [ u'request' ] . path_info return path . startswith ( page . get_absolute_url ( ) ) else : if ( feincms_page is None ) : feincms_page = context [ u'feincms_page' ] return page . is_ancestor_of ( feincms_page , include_self = True )
usage example:: {% feincms_nav feincms_page level=1 as toplevel %} <ul> {% for page in toplevel %} {% page_is_active page as is_active %} <li {% if is_active %}class="active"{% endif %}> <a href="{{ page .