@register.tag
def recursetree(parser, token):
 bits = token.contents.split()
 if (len(bits) != 2):
  raise template.TemplateSyntaxError((_(u'%s tag requires a queryset') % bits[0]))
 queryset_var = template.Variable(bits[1])
 template_nodes = parser.parse((u'endrecursetree',))
 parser.delete_first_token()
 return RecurseTreeNode(template_nodes, queryset_var)

@ register . tag def recursetree ( parser , token ) : bits = token . contents . split ( ) if ( len ( bits ) != 2 ) : raise template . TemplateSyntaxError ( ( _ ( u'%s tag requires a queryset' ) % bits [ 0 ] ) ) queryset_var = template . Variable ( bits [ 1 ] ) template_nodes = parser . parse ( ( u'endrecursetree' , ) ) parser . delete_first_token ( ) return RecurseTreeNode ( template_nodes , queryset_var )
iterates over the nodes in the tree .