mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +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.
|
Determine the set of validators to use when instantiating serializer.
|
||||||
"""
|
"""
|
||||||
# If the validators have been declared explicitly then use that.
|
# If the validators have been declared explicitly then use that.
|
||||||
validators = getattr(getattr(self, 'Meta', None), 'validators', None)
|
meta = getattr(self, 'Meta', None)
|
||||||
if validators is not None:
|
if meta is not None:
|
||||||
return validators[:]
|
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.
|
# Otherwise use the default set of validators.
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user