summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2017-12-02 07:48:49 +0500
committerTim Graham <timograham@gmail.com>2017-12-01 21:49:01 -0500
commit70da0420c2294cf9c851dc7703c8b729f1ed8956 (patch)
tree885de4f86d15f635caf413f843f7654318833376 /tests
parent4dc35e126d8461589b4b4bc47b6f6bd6cc4a1455 (diff)
[2.0.x] Fixed #28863 -- Fixed filter on annotation that contains Q.
Backport of cf12257db23fa248c89a3da3f718aa01a50ca659 from master
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 ca331aeb03..c0a36221a2 100644
--- a/tests/expressions/tests.py
+++ b/tests/expressions/tests.py
@@ -73,6 +73,15 @@ class BasicExpressionsTests(TestCase):
],
)
+ @unittest.skipIf(connection.vendor == 'oracle', "Oracle doesn't support using boolean type in SELECT")
+ def test_filtering_on_annotate_that_uses_q(self):
+ self.assertEqual(
+ Company.objects.annotate(
+ num_employees_check=ExpressionWrapper(Q(num_employees__gt=3), output_field=models.BooleanField())
+ ).filter(num_employees_check=True).count(),
+ 2,
+ )
+
def test_filter_inter_attribute(self):
# We can filter on attribute relationships on same model obj, e.g.
# find companies where the number of employees is greater