#8467: For ManyToMany manager, we should convert objects being added or removed 
to
the pk type if they are not.
-------------------------------------+-------------------------------------
     Reporter:  Wonlay               |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  Duplicate entry,     |             Triage Stage:  Accepted
  add, remove, ManyToManyField       |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  1                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

 I'm pretty sure we can consider this fixed by
 28712d8acfffa9cdabb88cb610bae14913fa185d.

 Even if we don't perform the conversion to the pk type in
 
[https://github.com/django/django/blob/master/django/db/models/fields/related_descriptors.py#L1066-L1067
 the branch handling non-model instances] of `_get_target_ids` we now
 ignore conflicts on bulk insertions so the collision on insertion is now
 ignored.

 I guess we could adjust the branch as an optimization if we wanted to by
 calling `target_field.to_python(obj)` by re-purposing this ticket as an
 optimization.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/8467#comment:14>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.916f8a063eb161e596d7c58237b5de5c%40djangoproject.com.

Reply via email to