@register.filter(is_safe=False)
def intword(value):
 try:
  value = int(value)
 except (TypeError, ValueError):
  return value
 if (value < 1000000):
  return value
 def _check_for_i18n(value, float_formatted, string_formatted):
  u'\n        Use the i18n enabled defaultfilters.floatformat if possible\n        '
  if settings.USE_L10N:
   value = defaultfilters.floatformat(value, 1)
   template = string_formatted
  else:
   template = float_formatted
  return (template % {u'value': value})
 for (exponent, converters) in intword_converters:
  large_number = (10 ** exponent)
  if (value < (large_number * 1000)):
   new_value = (value / float(large_number))
   return _check_for_i18n(new_value, *converters(new_value))
 return value

@ register . filter ( is_safe = False ) def intword ( value ) : try : value = int ( value ) except ( TypeError , ValueError ) : return value if ( value < 1000000 ) : return value def _check_for_i18n ( value , float_formatted , string_formatted ) : if settings . USE_L10N : value = defaultfilters . floatformat ( value , 1 ) template = string_formatted else : template = float_formatted return ( template % { u'value' : value } ) for ( exponent , converters ) in intword_converters : large_number = ( 10 ** exponent ) if ( value < ( large_number * 1000 ) ) : new_value = ( value / float ( large_number ) ) return _check_for_i18n ( new_value , * converters ( new_value ) ) return value
converts a large integer to a friendly text representation .