aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/serializers.py
diff options
context:
space:
mode:
authorTom Christie2013-03-12 18:35:20 +0000
committerTom Christie2013-03-12 18:35:20 +0000
commit2f1951910f264852b530c94c3a9946afe10eedd2 (patch)
treebb3ec4618e03a26c67e779d0dc6144029756c544 /rest_framework/serializers.py
parentd8c5dca9aea5ad073936c1c5b3975ed53a6aeca8 (diff)
downloaddjango-rest-framework-2f1951910f264852b530c94c3a9946afe10eedd2.tar.bz2
Descriptive text for NestedValidationError
Diffstat (limited to 'rest_framework/serializers.py')
-rw-r--r--rest_framework/serializers.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py
index 81619b3a..f83451d3 100644
--- a/rest_framework/serializers.py
+++ b/rest_framework/serializers.py
@@ -21,6 +21,16 @@ from rest_framework.fields import *
class NestedValidationError(ValidationError):
+ """
+ The default ValidationError behavior is to stringify each item in the list
+ if the messages are a list of error messages.
+
+ In the case of nested serializers, where the parent has many children,
+ then the child's `serializer.errors` will be a list of dicts.
+
+ We need to override the default behavior to get properly nested error dicts.
+ """
+
def __init__(self, message):
self.messages = message