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:
committed by
Tim Graham
parent
c7aff31397
commit
b971c1cd78
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user