#13546: Feature request: USE_L10N as default value for form Field
-------------------+--------------------------------------------------------
Reporter: hsk | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Keywords: | Stage: Unreviewed
Has_patch: 1 |
-------------------+--------------------------------------------------------
When USE_L10N is set to True in settings, you still has to customize every
single form Field to use it in forms. While this is fairly easy with the
localize argument to django.forms.fields.Field, it is not easy if you use
a ModelForm. In that case, you have to do something similar to this:
{{{
class CustomForm(ModelForm):
class Meta:
model = SomeModel
def __init__(self, *args, **kwargs):
super(CustomForm, self).__init__(*args, **kwargs)
self.fields['some_field'].localize = True
}}}
Where some_field in SomeModel for example could be a DecimalField.
I therefore suggest that the USE_L10N setting is used as default value for
form Field, as done in the attached patch.
--
Ticket URL: <http://code.djangoproject.com/ticket/13546>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.