mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-02 20:54:42 +03:00
DecimalField fix
max_value and min_value are not in kwargs
This commit is contained in:
parent
9cb547b85f
commit
91416632a8
|
@ -733,9 +733,12 @@ class DecimalField(Field):
|
||||||
self.max_digits = max_digits
|
self.max_digits = max_digits
|
||||||
self.decimal_places = decimal_places
|
self.decimal_places = decimal_places
|
||||||
self.coerce_to_string = coerce_to_string if (coerce_to_string is not None) else self.coerce_to_string
|
self.coerce_to_string = coerce_to_string if (coerce_to_string is not None) else self.coerce_to_string
|
||||||
self.max_value = kwargs.pop('max_value', None)
|
|
||||||
self.min_value = kwargs.pop('min_value', None)
|
self.max_value = max_value
|
||||||
|
self.min_value = min_value
|
||||||
|
|
||||||
super(DecimalField, self).__init__(**kwargs)
|
super(DecimalField, self).__init__(**kwargs)
|
||||||
|
|
||||||
if self.max_value is not None:
|
if self.max_value is not None:
|
||||||
message = self.error_messages['max_value'].format(max_value=self.max_value)
|
message = self.error_messages['max_value'].format(max_value=self.max_value)
|
||||||
self.validators.append(MaxValueValidator(self.max_value, message=message))
|
self.validators.append(MaxValueValidator(self.max_value, message=message))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user