@register.filter
def is_parent_of(page1, page2):
 try:
  return page1.is_ancestor_of(page2)
 except (AttributeError, ValueError):
  return False

@ register . filter def is_parent_of ( page1 , page2 ) : try : return page1 . is_ancestor_of ( page2 ) except ( AttributeError , ValueError ) : return False
determines whether a given page is the parent of another page example:: {% if page|is_parent_of:feincms_page %} .