Replies: 2 comments
-
Yes, I encountered this issue as well. When the serializer gathers constraints from the model, it doesn’t account for the fact that a constraint might include a custom error message. Additionally, the |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi! I face to the same issue. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Example Model
class UniqueTest(BaseModel):
answer = models.ForeignKey(Answer, on_delete=models.CASCADE)
subject = models.ForeignKey(Subject, on_delete=models.CASCADE)
date = models.DateField()
Sample error response for violation
{
"non_field_errors": [
"The fields answer, subject, date must make a unique set."
]
}
Expected error response
{
"non_field_errors": [
"test error message"
]
}
Beta Was this translation helpful? Give feedback.
All reactions