get_or_create UNIQUE constraint error

Hi @philgyford , I found the problem!

The issue was here: object, created = self.model1.get_or_create. I was using self.model1 instead of model1.objects.get_or_create, so Django wasn’t searching for the record within the entire model1 table.

Now it’s working! Thanks for your time!

1 Like