From ca4c6f65ea81109cf6fbdba74da7f5027eb0c4db Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Sat, 27 Mar 2010 16:43:27 +0000 Subject: Fixed #13032 - Added localize parameter to form fields to be able to selectively enable localization. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12867 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/ref/forms/fields.txt | 15 +++++++++++++++ docs/topics/i18n/localization.txt | 7 +++++++ 2 files changed, 22 insertions(+) (limited to 'docs') diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt index 22fabb3fa8..396e51046e 100644 --- a/docs/ref/forms/fields.txt +++ b/docs/ref/forms/fields.txt @@ -259,6 +259,7 @@ error message keys it uses. ``validators`` ~~~~~~~~~~~~~~ + .. versionadded:: 1.2 .. attribute:: Field.validators @@ -268,6 +269,20 @@ for this field. See the :ref:`validators documentation ` for more information. +``localize`` +~~~~~~~~~~~~ + +.. versionadded:: 1.2 + +.. attribute:: Field.localize + +The ``localize`` argument enables the localization of form data, input as well +as the rendered output. + +See the :ref:`format localization ` documentation for +more information. + + Built-in ``Field`` classes -------------------------- diff --git a/docs/topics/i18n/localization.txt b/docs/topics/i18n/localization.txt index 10e59230e0..8e1beaef46 100644 --- a/docs/topics/i18n/localization.txt +++ b/docs/topics/i18n/localization.txt @@ -268,6 +268,13 @@ Django uses different formats for different locales when guessing the format used by the user when inputting data on forms. Note that Django uses different formats for displaying data, and for parsing it. +To enable a form field to localize input and output data simply use its +``localize`` argument:: + + class CashRegisterForm(forms.Form): + product = forms.CharField() + revenue = forms.DecimalField(max_digits=4, decimal_places=2, localize=True) + Creating custom format files ---------------------------- -- cgit v1.3