Fixed #25550 -- Deprecated direct assignment to the reverse side of a related set.

This commit is contained in:
Tim Graham 2015-10-08 17:17:10 -04:00
parent 0b5d32faca
commit 9c5e272860
37 changed files with 194 additions and 130 deletions

View file

@ -74,7 +74,7 @@ class M2MRegressionTests(TestCase):
t2 = Tag.objects.create(name='t2')
c1 = TagCollection.objects.create(name='c1')
c1.tags = [t1, t2]
c1.tags.set([t1, t2])
c1 = TagCollection.objects.get(name='c1')
self.assertQuerysetEqual(c1.tags.all(), ["<Tag: t1>", "<Tag: t2>"], ordered=False)
@ -104,10 +104,10 @@ class M2MRegressionTests(TestCase):
t1 = Tag.objects.create(name='t1')
t2 = Tag.objects.create(name='t2')
c1 = TagCollection.objects.create(name='c1')
c1.tags = [t1, t2]
c1.tags.set([t1, t2])
with self.assertRaises(TypeError):
c1.tags = 7
c1.tags.set(7)
c1.refresh_from_db()
self.assertQuerysetEqual(c1.tags.order_by('name'), ["<Tag: t1>", "<Tag: t2>"])