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

Fixed #25506 -- Allowed filtering over a RawSQL annotation.

Co-Authored-By: Gavin Wahl <gwahl@fusionbox.com>
This commit is contained in:
Antoine Catton
2015-10-05 14:13:14 -06:00
committed by Tim Graham
parent c7aff31397
commit b971c1cd78
3 changed files with 15 additions and 1 deletions

View File

@@ -57,6 +57,18 @@ class BasicExpressionsTests(TestCase):
)
self.assertEqual(companies['result'], 2395)
def test_annotate_values_filter(self):
companies = Company.objects.annotate(
foo=RawSQL('%s', ['value']),
).filter(foo='value').order_by('name')
self.assertQuerysetEqual(
companies, [
'<Company: Example Inc.>',
'<Company: Foobar Ltd.>',
'<Company: Test GmbH>',
],
)
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