1
0
mirror of https://github.com/django/django.git synced 2025-10-25 06:36:07 +00:00

[5.2.x] Fixed #36149 -- Allowed subquery values against tuple exact and in lookups.

Non-tuple exact and in lookups have specialized logic for subqueries that can
be adapted to properly assign select mask if unspecified and ensure the number
of involved members are matching on both side of the operator.

Backport of 41239fe34d from main.
This commit is contained in:
Simon Charette
2025-01-27 23:10:13 -05:00
committed by Sarah Boyce
parent f8fce8d4dc
commit dc1c9b4ddd
12 changed files with 137 additions and 77 deletions

View File

@@ -922,20 +922,6 @@ class Queries1Tests(TestCase):
[self.t2, self.t3],
)
# Multi-valued values() and values_list() querysets should raise errors.
with self.assertRaisesMessage(
TypeError, "Cannot use multi-field values as a filter value."
):
Tag.objects.filter(
name__in=Tag.objects.filter(parent=self.t1).values("name", "id")
)
with self.assertRaisesMessage(
TypeError, "Cannot use multi-field values as a filter value."
):
Tag.objects.filter(
name__in=Tag.objects.filter(parent=self.t1).values_list("name", "id")
)
def test_ticket9985(self):
# qs.values_list(...).values(...) combinations should work.
self.assertSequenceEqual(