1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #29142 -- Fixed crash when OuterRef is used with an operator.

This commit is contained in:
Matthew Schinckel
2018-02-23 18:01:01 +10:30
committed by Tim Graham
parent f5c6fc045a
commit c412926a2e
2 changed files with 8 additions and 0 deletions

View File

@@ -575,6 +575,11 @@ class BasicExpressionsTests(TestCase):
outer = Result.objects.filter(pk__in=Subquery(inner.values('pk')))
self.assertFalse(outer.exists())
def test_outerref_with_operator(self):
inner = Company.objects.filter(num_employees=OuterRef('ceo__salary') + 2)
outer = Company.objects.filter(pk__in=Subquery(inner.values('pk')))
self.assertEqual(outer.get().name, 'Test GmbH')
class IterableLookupInnerExpressionsTests(TestCase):
@classmethod