mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 20:40:14 +03:00
Merge 82d955d345
into 26623436f3
This commit is contained in:
commit
7e677ba259
|
@ -1429,9 +1429,14 @@ class ModelSerializer(Serializer):
|
|||
Determine the set of validators to use when instantiating serializer.
|
||||
"""
|
||||
# If the validators have been declared explicitly then use that.
|
||||
validators = getattr(getattr(self, 'Meta', None), 'validators', None)
|
||||
if validators is not None:
|
||||
return validators[:]
|
||||
meta = getattr(self, 'Meta', None)
|
||||
if meta is not None:
|
||||
validators = getattr(meta, 'validators', None)
|
||||
if isinstance(validators, property):
|
||||
validators = getattr(meta(), 'validators', None)
|
||||
|
||||
if validators is not None:
|
||||
return validators[:]
|
||||
|
||||
# Otherwise use the default set of validators.
|
||||
return (
|
||||
|
|
Loading…
Reference in New Issue
Block a user