19
I am writing a Django app for use in a country where they use comma as decimal separator. I have a model that contains a django.db.models.DecimalField, and I use model forms. How can I make the resulting form field render using comma and accept comma back from the user?
Following the advice of jweyrich, I have upgraded my application from Django 1.1 to Django 1.2 and edited my settings.py to contain the following:
LANGUAGE_CODE = 'nb'
LANGUAGES = (
('nb', 'Norwegian'),
)
USE_I18N = True
USE_L10N = True
DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = ' '
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
)
As far as I can see, this is all that the documentation calls for. It now works for forms if I set localization=True on the form field. It works in neither model forms nor the admin site, however.
I discovered a Django ticke