I'm running load tests with JMeter on a Django project with a Postgres database. This has managed to cause duplicate primary key errors when creating M2M objects;
IntegrityError: duplicate key value violates unique constraint "entry_entrycharityenquiry_pkey"
DETAIL: Key (id)=(108) already exists.
This is happening when trying to create the relationship to objects after a user has selected from a list;
for ec in to_add: EntryCharityEnquiry.objects.create(**kwargs)
I can't see a problem with creating objects in a loop, so where/what could the error come from?