From 1bdf641dadc8e4f0274fb81008dc126d05f2d03a Mon Sep 17 00:00:00 2001 From: Agustin Formoso Date: Mon, 9 Apr 2018 11:58:57 +0200 Subject: [PATCH] There are some cases in which users may not want to have an error reply on `any`, for exmaple on `all`. --- rest_framework/serializers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 7e84372de..07a59364a 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -630,7 +630,7 @@ class ListSerializer(BaseSerializer): 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. """ @@ -666,7 +666,7 @@ class ListSerializer(BaseSerializer): ret.append(validated) errors.append({}) - if any(errors): + if error_function(errors): raise ValidationError(errors) return ret