mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #29860 -- Allowed BaseValidator to accept a callable limit_value.
This commit is contained in:
@@ -317,8 +317,9 @@ class BaseValidator:
|
||||
|
||||
def __call__(self, value):
|
||||
cleaned = self.clean(value)
|
||||
params = {'limit_value': self.limit_value, 'show_value': cleaned, 'value': value}
|
||||
if self.compare(cleaned, self.limit_value):
|
||||
limit_value = self.limit_value() if callable(self.limit_value) else self.limit_value
|
||||
params = {'limit_value': limit_value, 'show_value': cleaned, 'value': value}
|
||||
if self.compare(cleaned, limit_value):
|
||||
raise ValidationError(self.message, code=self.code, params=params)
|
||||
|
||||
def __eq__(self, other):
|
||||
|
||||
Reference in New Issue
Block a user