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
}
Run Code Online (Sandbox Code Playgroud)
这是我想要的东西。
{
"message": "customer with this phone already exists, customer with this
email already exists, customer with this tenant id already exists"
"success": false,
"error": 1
}
Run Code Online (Sandbox Code Playgroud)