diff options
| author | David Smith <39445562+smithdc1@users.noreply.github.com> | 2021-01-16 16:49:02 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-16 17:49:02 +0100 |
| commit | e58f79c535affa9719f1a9f2b9762e338384a22e (patch) | |
| tree | 2154c1f845248a06d78e113d55a9ce47e8063d6a | |
| parent | 88e972e46d71520fbb480642cf957185e5a14a46 (diff) | |
Improved performance of DecimalField.
strip() is unnecessary because decimal.Decimal() strips the input value.
| -rw-r--r-- | django/forms/fields.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/django/forms/fields.py b/django/forms/fields.py index 17c7956b53..daa65d61eb 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -343,9 +343,8 @@ class DecimalField(IntegerField): return None if self.localize: value = formats.sanitize_separators(value) - value = str(value).strip() try: - value = Decimal(value) + value = Decimal(str(value)) except DecimalException: raise ValidationError(self.error_messages['invalid'], code='invalid') return value |
