summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/expressions/tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
index 38258e0dd0..5483a17fd1 100644
--- a/tests/expressions/tests.py
+++ b/tests/expressions/tests.py
@@ -516,6 +516,15 @@ class BasicExpressionsTests(TestCase):
[{'salary': 10, 'total_employees': 2300}, {'salary': 20, 'total_employees': 35}],
)
+ def test_subquery_references_joined_table_twice(self):
+ inner = Company.objects.filter(
+ num_chairs__gte=OuterRef('ceo__salary'),
+ num_employees__gte=OuterRef('point_of_contact__salary'),
+ )
+ # Another contrived example (there is no need to have a subquery here)
+ outer = Company.objects.filter(pk__in=Subquery(inner.values('pk')))
+ self.assertFalse(outer.exists())
+
class IterableLookupInnerExpressionsTests(TestCase):
@classmethod