summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon Charette <simon.charette@zapier.com>2019-08-15 23:20:57 -0400
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-08-17 11:24:35 +0200
commit8b4a43dda702fe72c254388f1be2c0c75b7a3efc (patch)
treea416e2c9bdad50b2c38ae6ca760b17bec8ae46a8 /tests
parent7203efb799969b4662ecb58f4cefd2a5f2e0062b (diff)
Fixed #29545 -- Fixed using filter lookups againts nested subquery expressions.
Made sql.Where resolve lhs of its child nodes. This is necessary to allow filter lookups against nested subquery expressions to properly resolve their OuterRefs to Cols. Thanks Oskar Persson for the simplified test case.
Diffstat (limited to 'tests')
-rw-r--r--tests/lookup/tests.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/lookup/tests.py b/tests/lookup/tests.py
index 7bf436ad7a..a603824c0d 100644
--- a/tests/lookup/tests.py
+++ b/tests/lookup/tests.py
@@ -942,3 +942,17 @@ class LookupTests(TestCase):
pk_exists=Exists(qs),
)
self.assertCountEqual(seasons, Season.objects.all())
+
+ def test_nested_outerref_lhs(self):
+ tag = Tag.objects.create(name=self.au1.alias)
+ tag.articles.add(self.a1)
+ qs = Tag.objects.annotate(
+ has_author_alias_match=Exists(
+ Article.objects.annotate(
+ author_exists=Exists(
+ Author.objects.filter(alias=OuterRef(OuterRef('name')))
+ ),
+ ).filter(author_exists=True)
+ ),
+ )
+ self.assertEqual(qs.get(has_author_alias_match=True), tag)