mirror of
https://github.com/django/django.git
synced 2025-09-26 20:19:16 +00:00
Refs #20939 -- Removed the Query._prepare_as_filter_value() hack.
This commit is contained in:
parent
ec50937bcb
commit
c9159a082e
2 changed files with 17 additions and 22 deletions
|
@ -1099,14 +1099,16 @@ class QuerySet:
|
|||
for field, objects in other._known_related_objects.items():
|
||||
self._known_related_objects.setdefault(field, {}).update(objects)
|
||||
|
||||
def _prepare_as_filter_value(self):
|
||||
def resolve_expression(self, *args, **kwargs):
|
||||
if self._fields and len(self._fields) > 1:
|
||||
# values() queryset can only be used as nested queries
|
||||
# if they are set up to select only a single field.
|
||||
if len(self._fields) > 1:
|
||||
raise TypeError('Cannot use multi-field values as a filter value.')
|
||||
queryset = self._clone()
|
||||
return queryset.query.as_subquery_filter(queryset._db)
|
||||
query = self.query.resolve_expression(*args, **kwargs)
|
||||
query._db = self._db
|
||||
return query
|
||||
resolve_expression.queryset_only = True
|
||||
|
||||
def _add_hints(self, **hints):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue