diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2020-07-26 19:18:59 -0700 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-07-27 12:07:53 +0200 |
| commit | cc3d24d7d577f174937a0744d886c4c7123cfa85 (patch) | |
| tree | d96aa65fb38ee91158ff6908374e267df5646f9e | |
| parent | f4e93919e4608cfc50849a1f764fd856e0917401 (diff) | |
Removed redundant forms.DecimalField.validate() in favor of DecimalValidator.
| -rw-r--r-- | django/core/validators.py | 2 | ||||
| -rw-r--r-- | django/forms/fields.py | 7 |
2 files changed, 1 insertions, 8 deletions
diff --git a/django/core/validators.py b/django/core/validators.py index 84b4f31ec7..a9b8855d0e 100644 --- a/django/core/validators.py +++ b/django/core/validators.py @@ -438,7 +438,7 @@ class DecimalValidator: def __call__(self, value): digit_tuple, exponent = value.as_tuple()[1:] if exponent in {'F', 'n', 'N'}: - raise ValidationError(self.messages['invalid']) + raise ValidationError(self.messages['invalid'], code='invalid') if exponent >= 0: # A positive exponent adds that many trailing zeros. digits = len(digit_tuple) + exponent diff --git a/django/forms/fields.py b/django/forms/fields.py index 36dad72704..9de2c60b35 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -350,13 +350,6 @@ class DecimalField(IntegerField): raise ValidationError(self.error_messages['invalid'], code='invalid') return value - def validate(self, value): - super().validate(value) - if value in self.empty_values: - return - if not value.is_finite(): - raise ValidationError(self.error_messages['invalid'], code='invalid') - def widget_attrs(self, widget): attrs = super().widget_attrs(widget) if isinstance(widget, NumberInput) and 'step' not in widget.attrs: |
