#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 Baptiste Mispelon):

 I was unable to reproduce this on a recent version (tag `3.0rc1` for
 example).

 I'm using the following test case (same models as in the original ticket):
 {{{
 from django.db import IntegrityError
 from django.test import TestCase

 from .models import A, B


 class Ticket8467TestCase(TestCase):
     def test_integrityerror(self):
         pk = A.objects.create().pk

         b = B.objects.create()
         b.a.add(str(pk))
         with self.assertRaises(IntegrityError):
             b.a.add(str(pk))
 }}}

 This test fails (meaning that an `IntegrityError` is not raised) on
 `3.0rc1` but passes for `2.2`.
 Using `git bisect`, I tracked it down to this commit:
 28712d8acfffa9cdabb88cb610bae14913fa185d.

 However it's not immediately clear to me why that commit would fix this
 ticket so I'm unsure whether I should close this ticket.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/8467#comment:13>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.9bc96ed050357fdf893fa164f9c126ad%40djangoproject.com.

Reply via email to