【发布时间】:2017-11-29 03:53:37
【问题描述】:
DRF 给出的默认验证错误消息是密钥和消息的列表。将此格式自定义为文本格式的最佳方法是什么。例如。
这是默认格式。
{
"message": {
"phone": [
"customer with this phone already exists."
],
"email": [
"customer with this email already exists."
],
"tenant_id": [
"customer with this tenant id already exists."
]
},
"success": false,
"error": 1
}
这是我想要的。
{
"message": "customer with this phone already exists, customer with this
email already exists, customer with this tenant id already exists"
"success": false,
"error": 1
}
【问题讨论】:
标签: django django-rest-framework