def get_formats():
 FORMAT_SETTINGS = ('DATE_FORMAT', 'DATETIME_FORMAT', 'TIME_FORMAT', 'YEAR_MONTH_FORMAT', 'MONTH_DAY_FORMAT', 'SHORT_DATE_FORMAT', 'SHORT_DATETIME_FORMAT', 'FIRST_DAY_OF_WEEK', 'DECIMAL_SEPARATOR', 'THOUSAND_SEPARATOR', 'NUMBER_GROUPING', 'DATE_INPUT_FORMATS', 'TIME_INPUT_FORMATS', 'DATETIME_INPUT_FORMATS')
 result = {}
 for module in ([settings] + get_format_modules(reverse=True)):
  for attr in FORMAT_SETTINGS:
   result[attr] = get_format(attr)
 src = []
 for (k, v) in result.items():
  if isinstance(v, (basestring, int)):
   src.append(("formats['%s'] = '%s';\n" % (javascript_quote(k), javascript_quote(smart_unicode(v)))))
  elif isinstance(v, (tuple, list)):
   v = [javascript_quote(smart_unicode(value)) for value in v]
   src.append(("formats['%s'] = ['%s'];\n" % (javascript_quote(k), "', '".join(v))))
 return ''.join(src)

def get_formats ( ) : FORMAT_SETTINGS = ( 'DATE_FORMAT' , 'DATETIME_FORMAT' , 'TIME_FORMAT' , 'YEAR_MONTH_FORMAT' , 'MONTH_DAY_FORMAT' , 'SHORT_DATE_FORMAT' , 'SHORT_DATETIME_FORMAT' , 'FIRST_DAY_OF_WEEK' , 'DECIMAL_SEPARATOR' , 'THOUSAND_SEPARATOR' , 'NUMBER_GROUPING' , 'DATE_INPUT_FORMATS' , 'TIME_INPUT_FORMATS' , 'DATETIME_INPUT_FORMATS' ) result = { } for module in ( [ settings ] + get_format_modules ( reverse = True ) ) : for attr in FORMAT_SETTINGS : result [ attr ] = get_format ( attr ) src = [ ] for ( k , v ) in result . items ( ) : if isinstance ( v , ( basestring , int ) ) : src . append ( ( "formats['%s'] = '%s';\n" % ( javascript_quote ( k ) , javascript_quote ( smart_unicode ( v ) ) ) ) ) elif isinstance ( v , ( tuple , list ) ) : v = [ javascript_quote ( smart_unicode ( value ) ) for value in v ] src . append ( ( "formats['%s'] = ['%s'];\n" % ( javascript_quote ( k ) , "', '" . join ( v ) ) ) ) return '' . join ( src )
returns all formats strings required for i18n to work .