mirror of
https://github.com/django/django.git
synced 2025-08-03 02:23:12 +00:00
Fixed #20242 - Added a regression test for prefetch_related.
Issue was fixed by removal of chunked reads from
QuerySet iteration in 70679243d1
.
Thanks Simeon Visser for the patch.
This commit is contained in:
parent
1fdc3d256d
commit
a2967d5204
2 changed files with 11 additions and 0 deletions
|
@ -107,6 +107,16 @@ class PrefetchRelatedTests(TestCase):
|
|||
qs = Book.objects.prefetch_related('first_time_authors')
|
||||
[b.first_time_authors.exists() for b in qs]
|
||||
|
||||
def test_in_and_prefetch_related(self):
|
||||
"""
|
||||
Regression test for #20242 - QuerySet "in" didn't work the first time
|
||||
when using prefetch_related. This was fixed by the removal of chunked
|
||||
reads from QuerySet iteration in
|
||||
70679243d1786e03557c28929f9762a119e3ac14.
|
||||
"""
|
||||
qs = Book.objects.prefetch_related('first_time_authors')
|
||||
self.assertTrue(qs[0] in qs)
|
||||
|
||||
def test_clear(self):
|
||||
"""
|
||||
Test that we can clear the behavior by calling prefetch_related()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue