From 91416632a86f518a043ac1b82da3d1774701ba96 Mon Sep 17 00:00:00 2001 From: Rense VanderHoek Date: Sat, 21 Feb 2015 12:31:37 +0100 Subject: [PATCH] DecimalField fix max_value and min_value are not in kwargs --- rest_framework/fields.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 1474f1db4..13ea6dde7 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -733,9 +733,12 @@ class DecimalField(Field): self.max_digits = max_digits 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.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) + if self.max_value is not None: message = self.error_messages['max_value'].format(max_value=self.max_value) self.validators.append(MaxValueValidator(self.max_value, message=message))