1 | | Thanks for the report! |
| 1 | Thanks for the report! A regression test: |
| 2 | {{{#!diff |
| 3 | diff --git a/tests/filtered_relation/tests.py b/tests/filtered_relation/tests.py |
| 4 | index 790a90d9e2..1208ddde5f 100644 |
| 5 | --- a/tests/filtered_relation/tests.py |
| 6 | +++ b/tests/filtered_relation/tests.py |
| 7 | @@ -211,6 +211,33 @@ class FilteredRelationTests(TestCase): |
| 8 | str(queryset.query), |
| 9 | ) |
| 10 | |
| 11 | + def test_multiple(self): |
| 12 | + qs = ( |
| 13 | + Author.objects.annotate( |
| 14 | + book_title_alice=FilteredRelation( |
| 15 | + "book", condition=Q(book__title__contains="Alice") |
| 16 | + ), |
| 17 | + book_title_jane=FilteredRelation( |
| 18 | + "book", condition=Q(book__title__icontains="Jane") |
| 19 | + ), |
| 20 | + ) |
| 21 | + .filter(name="Jane") |
| 22 | + .values("book_title_alice__title", "book_title_jane__title") |
| 23 | + ) |
| 24 | + self.assertSequenceEqual( |
| 25 | + qs, |
| 26 | + [ |
| 27 | + { |
| 28 | + "book_title_alice__title": None, |
| 29 | + "book_title_jane__title": "The book by Jane A", |
| 30 | + }, |
| 31 | + { |
| 32 | + "book_title_alice__title": None, |
| 33 | + "book_title_jane__title": "The book by Jane B", |
| 34 | + }, |
| 35 | + ], |
| 36 | + ) |
| 37 | + |
| 38 | def test_with_multiple_filter(self): |
| 39 | self.assertSequenceEqual( |
| 40 | Author.objects.annotate( |
| 41 | }}} |