Return Decimal instance instead of string

This commit is contained in:
Stephan Groß 2013-04-15 15:24:14 +02:00
parent 9d80f01bce
commit cac6697025
2 changed files with 2 additions and 7 deletions

View File

@ -761,11 +761,6 @@ class DecimalField(WritableField):
raise ValidationError(self.error_messages['invalid']) raise ValidationError(self.error_messages['invalid'])
return value return value
def to_native(self, value):
if value is not None:
return str(value)
return value
def validate(self, value): def validate(self, value):
super(DecimalField, self).validate(value) super(DecimalField, self).validate(value)
if value in validators.EMPTY_VALUES: if value in validators.EMPTY_VALUES:

View File

@ -559,8 +559,8 @@ class DecimalFieldTest(TestCase):
result_1 = f.to_native(Decimal('9000')) result_1 = f.to_native(Decimal('9000'))
result_2 = f.to_native(Decimal('1.00000001')) result_2 = f.to_native(Decimal('1.00000001'))
self.assertEqual('9000', result_1) self.assertEqual(Decimal('9000'), result_1)
self.assertEqual('1.00000001', result_2) self.assertEqual(Decimal('1.00000001'), result_2)
def test_to_native_none(self): def test_to_native_none(self):
""" """