There are some cases in which users may not want to have an error reply on any, for exmaple on all.

This commit is contained in:
Agustin Formoso 2018-04-09 11:58:57 +02:00
parent 0178d3063d
commit 1bdf641dad

View File

@ -630,7 +630,7 @@ class ListSerializer(BaseSerializer):
return value return value
def to_internal_value(self, data): def to_internal_value(self, data, error_function=any):
""" """
List of dicts of native values <- List of dicts of primitive datatypes. List of dicts of native values <- List of dicts of primitive datatypes.
""" """
@ -666,7 +666,7 @@ class ListSerializer(BaseSerializer):
ret.append(validated) ret.append(validated)
errors.append({}) errors.append({})
if any(errors): if error_function(errors):
raise ValidationError(errors) raise ValidationError(errors)
return ret return ret