Django Factory boy and django hashid field primary key: "UNIQUE constraint failed"

544 Views Asked by At

I am using django hashid field in model primary keys and i'd like to use django factory boy for creating factories.

class Camera(models.Model): id = HashidAutoField(primary_key=True)

But as soon as I create factory for the second time I get this error.

return Database.Cursor.execute(self, query, params) django.db.utils.IntegrityError: UNIQUE constraint failed: camera_camera.id

How does factory boy deal with custom fields?

0

There are 0 best solutions below