@register.tag<EOL>def overextends(parser, token):
bits = token.split_contents()<EOL>if len(bits) != <NUM_LIT:2>:<EOL><INDENT>raise TemplateSyntaxError("<STR_LIT>" % bits[<NUM_LIT:0>])<EOL><DEDENT>parent_name = parser.compile_filter(bits[<NUM_LIT:1>])<EOL>nodelist = parser.parse()<EOL>if nodelist.get_nodes_by_type(ExtendsNode):<EOL><INDENT>raise TemplateSyntaxError("<STR_LIT>"<EOL>"<STR_LIT>" % bits[<NUM_LIT:0>])<EOL><DEDENT>return OverExtendsNode(nodelist, parent_name, None)<EOL>
Extended version of Django's ``extends`` tag that allows circular
inheritance to occur, eg a template can both be overridden and
extended at once.