This commit is contained in:
Andreas Backx 2017-05-27 02:57:01 +00:00 committed by GitHub
commit 7e677ba259

View File

@ -1429,7 +1429,12 @@ 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 meta is not None:
validators = getattr(meta, 'validators', None)
if isinstance(validators, property):
validators = getattr(meta(), 'validators', None)
if validators is not None: if validators is not None:
return validators[:] return validators[:]