mirror of
https://github.com/django/django.git
synced 2025-11-29 06:51:10 +00:00
Fixed #24719 -- Restored the ability to use interators as queryset related object filters.
This commit is contained in:
parent
eaeea6f947
commit
9c2d8cde77
3 changed files with 8 additions and 1 deletions
|
|
@ -8,7 +8,7 @@ all about the internals of models in order to get the information it needs.
|
|||
"""
|
||||
import copy
|
||||
import warnings
|
||||
from collections import Mapping, OrderedDict
|
||||
from collections import Iterator, Mapping, OrderedDict
|
||||
from itertools import chain, count, product
|
||||
from string import ascii_uppercase
|
||||
|
||||
|
|
@ -1148,6 +1148,9 @@ class Query(object):
|
|||
field, sources, opts, join_list, path = self.setup_joins(
|
||||
parts, opts, alias, can_reuse=can_reuse, allow_many=allow_many)
|
||||
|
||||
# Prevent iterator from being consumed by check_related_objects()
|
||||
if isinstance(value, Iterator):
|
||||
value = list(value)
|
||||
self.check_related_objects(field, value, opts)
|
||||
|
||||
# split_exclude() needs to know which joins were generated for the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue