mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #25550 -- Deprecated direct assignment to the reverse side of a related set.
This commit is contained in:
parent
0b5d32faca
commit
9c5e272860
37 changed files with 194 additions and 130 deletions
|
@ -677,13 +677,13 @@ class LookupTests(TestCase):
|
|||
season_2011.games.create(home="Houston Astros", away="St. Louis Cardinals")
|
||||
season_2011.games.create(home="Houston Astros", away="Milwaukee Brewers")
|
||||
hunter_pence = Player.objects.create(name="Hunter Pence")
|
||||
hunter_pence.games = Game.objects.filter(season__year__in=[2009, 2010])
|
||||
hunter_pence.games.set(Game.objects.filter(season__year__in=[2009, 2010]))
|
||||
pudge = Player.objects.create(name="Ivan Rodriquez")
|
||||
pudge.games = Game.objects.filter(season__year=2009)
|
||||
pudge.games.set(Game.objects.filter(season__year=2009))
|
||||
pedro_feliz = Player.objects.create(name="Pedro Feliz")
|
||||
pedro_feliz.games = Game.objects.filter(season__year__in=[2011])
|
||||
pedro_feliz.games.set(Game.objects.filter(season__year__in=[2011]))
|
||||
johnson = Player.objects.create(name="Johnson")
|
||||
johnson.games = Game.objects.filter(season__year__in=[2011])
|
||||
johnson.games.set(Game.objects.filter(season__year__in=[2011]))
|
||||
|
||||
# Games in 2010
|
||||
self.assertEqual(Game.objects.filter(season__year=2010).count(), 3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue