mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	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.
This commit is contained in:
		
				
					committed by
					
						 Mariusz Felisiak
						Mariusz Felisiak
					
				
			
			
				
	
			
			
			
						parent
						
							7203efb799
						
					
				
				
					commit
					8b4a43dda7
				
			| @@ -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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user