Django Rest Framework does it's own validations. For example when creating a user it can return something like this:
{
"username": [
"A user with that username already exists."
],
"password": [
"This field may not be blank."
],
"name": [
"This field may not be blank."
]
}
Is there an easy way to return an id error
instead of a text message? And if it is possible where do I find the id errors meanings? For example, if id error 1 is A user with that username already exists.
and id error 2 is This field may not be blank.
:
{
"username": [
"1"
],
"password": [
"2"
],
"name": [
"2"
]
}
So then in the applications that uses this server can use their own texts (for example, handle different laguages).
I don't want to use my own validations or change the error message. I want to send the id of the error. It's something that DRF should have, but I don't know if it is possible.