mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-02 20:54:42 +03:00
Descriptive text for NestedValidationError
This commit is contained in:
parent
d8c5dca9ae
commit
2f1951910f
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user