@register.tag
def cachedeterministic(parser, token):
 nodelist = parser.parse(('endcachedeterministic',))
 parser.delete_first_token()
 tokens = token.contents.split()
 if (len(tokens) != 3):
  raise TemplateSyntaxError((u"'%r' tag requires 2 arguments." % tokens[0]))
 return CacheNode(nodelist, tokens[1], tokens[2])

@ register . tag def cachedeterministic ( parser , token ) : nodelist = parser . parse ( ( 'endcachedeterministic' , ) ) parser . delete_first_token ( ) tokens = token . contents . split ( ) if ( len ( tokens ) != 3 ) : raise TemplateSyntaxError ( ( u"'%r' tag requires 2 arguments." % tokens [ 0 ] ) ) return CacheNode ( nodelist , tokens [ 1 ] , tokens [ 2 ] )
this will cache the contents of a template fragment for a given amount of time .