File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -291,6 +291,13 @@ def test_foreign_field_exact(self):
291291 qs = Tour .objects .filter (exhibit__sections__number = 1 )
292292 self .assertCountEqual (qs , [self .egypt_tour , self .wonders_tour ])
293293
294+ def test_foreign_field_exact_expr (self ):
295+ """Querying from a foreign key to an EmbeddedModelArrayField."""
296+ with self .assertNumQueries (1 ) as ctx :
297+ qs = Tour .objects .filter (exhibit__sections__number = Value (2 ) - Value (1 ))
298+ self .assertCountEqual (qs , [self .egypt_tour , self .wonders_tour ])
299+ self .assertIn ("anyElementTrue" , ctx .captured_queries [0 ]["sql" ])
300+
294301 def test_foreign_field_with_slice (self ):
295302 qs = Tour .objects .filter (exhibit__sections__0_2__number__in = [1 , 2 ])
296303 self .assertCountEqual (qs , [self .wonders_tour , self .egypt_tour ])
You can’t perform that action at this time.
0 commit comments