Hello guys,

I can't detect any pattern, maybe 1 in each 1000 thousands edit of a 
certain model returns an IntegrityError on a m2m field. Most of the times 
this field wasn't even modified. When a model is saved I believe django 
always wipes the m2m field and then readds the items, right? I saw django 
calls clear() and then add()s the items. My code then fails with:

IntegrityError: duplicate key value violates unique constraint 
"app_model_m2m_field_key"

It seems like the add of items is performed before the items are cleared, 
which is very weird. I've tried to reproduce it but it's very hard, only 
happens occasionally. Any idea what could cause it? Could maybe setting 
auto commit solve this problem? Thanks in advance

Cheers,
Bernardo

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/OtS2XH-XyioJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to