Christian Schmitt
unread,May 15, 2013, 7:53:57 AM5/15/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
Hello,
I have a problem with localization and Select() Box, I have the values:
2.00
2.40
3.20
4.00
in my Database, but in Germany we use the number format:
2,00
2,40
3,20
4,00
Now I tried to Localize my modelform with:
class LocalizedModelForm(django.forms.ModelForm):
def __new__(cls, *args, **kwargs):
new_class = super(LocalizedModelForm, cls).__new__(cls)
for field in new_class.base_fields.values():
if isinstance(field, django.forms.DecimalField):
field.localize = True
field.widget.is_localized = True
if isinstance(field, django.forms.Select):
field.localize = True
field.widget.is_localized = True
return new_class
or even an __init__ with the following:
self.fields['endintensity'].localize = True
self.fields['endintensity'].widget.is_localized = True
But i still don't get the localized numbers?
How could i do this correctly??