User created duplicate even though unique=True

Hi, I’m a bit lost here, but one of our users managed to create a duplicate post despite unique=True in the model. I can’t reproduce the issue as it works as expected and a message crops up with “duplicate title” and won’t let me post. On speaking to the user, he claimed that it did pop up a message telling him of duplicate title, and when he went back to the list it was in there as a duplicate which resulted in a server 500 error when either one was clicked on, which is expected as the second instance should not be in there.

This is the first error I’ve had in 18 months in production, and I expect it may well have something to do with our work vpn which can get a bit clogged when busy, however, I thought that the unique validation actually came from the database which then raises the error to django thus making it not possible to actually post the duplicate. Is there a scenario where this could have been overriden in any way, I did find a post that claimed if you created a table with a field that was not unique and then updated it later on to be a unique field that that could cause an issue, but that was referring to Django 1.5, I’m using Django 3.1 currently.


Can you show us the relevant model and the part where the post is being created?

Is there a scenario where this could have been overriden in any way?

Maybe on a form validation or the model’s save method.

I know that if the field has null=True, PostgreSQL will still allow multiple instances to exist with a NULL value. I think the same is true for MySQL, but I’m not sure.