1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #24636 -- Added model field validation for decimal places and max digits.

This commit is contained in:
Iulia Chiriac
2015-04-14 18:11:12 -04:00
committed by Simon Charette
parent 6f1b09bb5c
commit 75ed590032
6 changed files with 134 additions and 49 deletions

View File

@@ -1578,6 +1578,12 @@ class DecimalField(Field):
]
return []
@cached_property
def validators(self):
return super(DecimalField, self).validators + [
validators.DecimalValidator(self.max_digits, self.decimal_places)
]
def deconstruct(self):
name, path, args, kwargs = super(DecimalField, self).deconstruct()
if self.max_digits is not None: