﻿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
19565	FloatField object returns string when it's value is set from string	jarek@…	nobody	"When float field is set from string value representing float, it is correctly saved (string is converted to float). But the field itself returns string in this case (even after save). This is pretty awful, because there is no error when the field is saved... and then suddenly you get a string value from field that you expect to return float. If you get access to the same row via different row, it - correctly - returns float instead.  

Expected behaviour - the field should consistently return float.

Some code presenting it. I am als attaching .zipped full django project with only this model and test.

model:
class TestModel(models.Model):
    test_field = FloatField(null=True)

test:

class TestFloatFieldAsString(TestCase):
    def test_float_field_as_string(self):
        model1 = TestModel(test_field=12.4)
        model1.save()
        print model1.test_field + 1.0

        model2 = TestModel(test_field='12.4')
        model2.save()
        try:
            print model2.test_field + 1.0
            self.fail(""Expect failure here"")
        except TypeError as exc:
            print ""expected:"" + str(exc)

        model3 = TestModel.objects.get(id = model2.id)
        print model3.test_field + 1.0"	Bug	closed	Uncategorized	1.4	Normal	invalid			Unreviewed	0	0	0	0	0	0
