@register.tag('localtime')
def localtime_tag(parser, token):
 bits = token.split_contents()
 if (len(bits) == 1):
  use_tz = True
 elif ((len(bits) > 2) or (bits[1] not in ('on', 'off'))):
  raise TemplateSyntaxError(("%r argument should be 'on' or 'off'" % bits[0]))
 else:
  use_tz = (bits[1] == 'on')
 nodelist = parser.parse(('endlocaltime',))
 parser.delete_first_token()
 return LocalTimeNode(nodelist, use_tz)

@ register . tag ( 'localtime' ) def localtime_tag ( parser , token ) : bits = token . split_contents ( ) if ( len ( bits ) == 1 ) : use_tz = True elif ( ( len ( bits ) > 2 ) or ( bits [ 1 ] not in ( 'on' , 'off' ) ) ) : raise TemplateSyntaxError ( ( "%r argument should be 'on' or 'off'" % bits [ 0 ] ) ) else : use_tz = ( bits [ 1 ] == 'on' ) nodelist = parser . parse ( ( 'endlocaltime' , ) ) parser . delete_first_token ( ) return LocalTimeNode ( nodelist , use_tz )
forces or prevents conversion of datetime objects to local time .