@register.tag(name='eval')
def do_eval(parser, token):
 nodelist = parser.parse(('endeval',))
 class EvalNode(template.Node, ):
  def render(self, context):
   return template.Template(nodelist.render(context)).render(template.Context(context))
 parser.delete_first_token()
 return EvalNode()

@ register . tag ( name = 'eval' ) def do_eval ( parser , token ) : nodelist = parser . parse ( ( 'endeval' , ) ) class EvalNode ( template . Node , ) : def render ( self , context ) : return template . Template ( nodelist . render ( context ) ) . render ( template . Context ( context ) ) parser . delete_first_token ( ) return EvalNode ( )
usage: {% eval %}1 + 1{% endeval %} .