Add docstring for CustomValidatorMessage

This commit is contained in:
Carlton Gibson 2017-09-26 09:53:42 +02:00 committed by GitHub
parent 24391db49e
commit 460666db65

View File

@ -299,6 +299,12 @@ except ImportError:
DecimalValidator = None
class CustomValidatorMessage(object):
"""
We need to avoid evaluation of `lazy` translated `message` in `django.core.validators.BaseValidator.__init__`.
https://github.com/django/django/blob/75ed5900321d170debef4ac452b8b3cf8a1c2384/django/core/validators.py#L297
Ref: https://github.com/encode/django-rest-framework/pull/5452
"""
def __init__(self, *args, **kwargs):
self.message = kwargs.pop('message', self.message)
super(CustomValidatorMessage, self).__init__(*args, **kwargs)