Improved performance of DecimalField.
strip() is unnecessary because decimal.Decimal() strips the input value.
This commit is contained in:
parent
88e972e46d
commit
e58f79c535
|
@ -343,9 +343,8 @@ class DecimalField(IntegerField):
|
||||||
return None
|
return None
|
||||||
if self.localize:
|
if self.localize:
|
||||||
value = formats.sanitize_separators(value)
|
value = formats.sanitize_separators(value)
|
||||||
value = str(value).strip()
|
|
||||||
try:
|
try:
|
||||||
value = Decimal(value)
|
value = Decimal(str(value))
|
||||||
except DecimalException:
|
except DecimalException:
|
||||||
raise ValidationError(self.error_messages['invalid'], code='invalid')
|
raise ValidationError(self.error_messages['invalid'], code='invalid')
|
||||||
return value
|
return value
|
||||||
|
|
Loading…
Reference in New Issue