When formatting is enabled, Django can use localized formats when parsing dates,
times and numbers in forms. That means it tries different formats for different
locales when guessing the format used by the user when inputting data on forms.

When you have enabled formatting with USE_L10N, Django
will try to use a locale specific format whenever it outputs a value
in a template.

However, it may not always be appropriate to use localized values –
for example, if you’re outputting JavaScript or XML that is designed
to be machine-readable, you will always want unlocalized values. You
may also want to use localization in selected templates, rather than
using localization everywhere.

To allow for fine control over the use of localization, Django
provides the l10n template library that contains the following
tags and filters.

Django provides format definitions for many locales, but sometimes you might
want to create your own, because a format files doesn’t exist for your locale,
or because you want to overwrite some of the values.

To use custom formats, specify the path where you’ll place format files
first. To do that, just set your FORMAT_MODULE_PATH setting to
the package where format files will exist, for instance:

FORMAT_MODULE_PATH=['mysite.formats','some_app.formats',]

Files are not placed directly in this directory, but in a directory named as
the locale, and must be named formats.py. Be careful not to put sensitive
information in these files as values inside can be exposed if you pass the
string to django.utils.formats.get_format() (used by the date
template filter).

To customize the English formats, a structure like this would be needed:

mysite/formats/__init__.pyen/__init__.pyformats.py

where formats.py contains custom format definitions. For example:

from__future__importunicode_literalsTHOUSAND_SEPARATOR='\xa0'

to use a non-breaking space (Unicode 00A0) as a thousand separator,
instead of the default for English, a comma.

The Swiss number formatting depends on the type of number that is being
formatted. For monetary values, a comma is used as the thousand separator and
a decimal point for the decimal separator. For all other numbers, a comma is
used as decimal separator and a space as thousand separator. The locale format
provided by Django uses the generic separators, a comma for decimal and a space
for thousand separators.