mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
[5.0.x] Fixed #35135 -- Made FilteredRelation raise ValueError on querysets as rhs.
Regression in59f4754704. Backport of820c5f1bacfrom main
This commit is contained in:
committed by
Mariusz Felisiak
parent
28d6db26a2
commit
a5440054d2
@@ -828,6 +828,16 @@ class FilteredRelationTests(TestCase):
|
||||
).filter(rel__isnull=True)
|
||||
self.assertSequenceEqual(qs, [])
|
||||
|
||||
def test_conditional_expression_does_not_support_queryset(self):
|
||||
msg = "Passing a QuerySet within a FilteredRelation is not supported."
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
Author.objects.annotate(
|
||||
poem_book=FilteredRelation(
|
||||
"book",
|
||||
condition=Q(book__in=Book.objects.filter(title__istartswith="a")),
|
||||
),
|
||||
).filter(poem_book__isnull=False)
|
||||
|
||||
|
||||
class FilteredRelationAggregationTests(TestCase):
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user