diff --git a/rest_framework/fields.py b/rest_framework/fields.py index a336528e85b..75fc31c5065 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -234,8 +234,9 @@ def get_error_detail(exc_info): """ code = getattr(exc_info, 'code', None) or 'invalid' return [ - ErrorDetail(msg, code=code) - for msg in exc_info.messages + ErrorDetail(error.message % (error.params or ()), + code=error.code if error.code else code) + for error in exc_info.error_list ]