@register.tag
def ratio(parser, token):
 bits = token.contents.split()
 if (len(bits) != 5):
  raise TemplateSyntaxError('widthratio takes three arguments')
 (tag, this_value_expr, min_value_expr, max_value_expr, max_width) = bits
 return RatioNode(parser.compile_filter(this_value_expr), parser.compile_filter(min_value_expr), parser.compile_filter(max_value_expr), parser.compile_filter(max_width))

@ register . tag def ratio ( parser , token ) : bits = token . contents . split ( ) if ( len ( bits ) != 5 ) : raise TemplateSyntaxError ( 'widthratio takes three arguments' ) ( tag , this_value_expr , min_value_expr , max_value_expr , max_width ) = bits return RatioNode ( parser . compile_filter ( this_value_expr ) , parser . compile_filter ( min_value_expr ) , parser . compile_filter ( max_value_expr ) , parser . compile_filter ( max_width ) )
for creating bar charts and such .