﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
19656	FloatField localization	michael.anckaert@…	nobody	"Currently the localization of the forms FloatField is controlled by the localize parameter to the field constructor and is independent from the project setting USE_L10N. 
When using a FloatField on a model in combination with Class Based Views and a standard generated ModelForm, this produces strange results: Localization nl-BE for example displays floats as 3,2 but forms require 3.2 (comma vs dot), essentially creating an unusable UpdateView. 

It would make sense to make localization default on FloatField when USE_L10N is on and use the localize parameter on FloatField to disable this. 

Below code is the modified FloatField method to_python, extra change would required changing default of localize in the constructor to True. 
    
{{{
def to_python(self, value):
        """"""
        Validates that float() can be called on the input. Returns the result
        of float(). Returns None for empty values.
        """"""
        value = super(IntegerField, self).to_python(value)
        if value in validators.EMPTY_VALUES:
            return None
        if settings.USE_L10N and self.localize:
            value = formats.sanitize_separators(value)
        try:
            value = float(value)
        except (ValueError, TypeError):
            raise ValidationError(self.error_messages['invalid'])
        return value
}}}


This change would require additional changes to the documentation to reflex the automatic localization of form fields when using USE_L10N."	New feature	closed	Forms	1.4	Normal	duplicate	FloatField Localization		Unreviewed	1	1	1	1	1	0
