mirror of
https://github.com/django/django.git
synced 2025-08-02 10:02:41 +00:00
Fixed #32483 -- Fixed QuerySet.values()/values_list() on JSONField key transforms with booleans on SQLite.
Thanks Matthew Cornell for the report.
This commit is contained in:
parent
c4df8b86c7
commit
71ec102b01
4 changed files with 30 additions and 33 deletions
|
@ -808,6 +808,16 @@ class TestQuerying(TestCase):
|
|||
with self.subTest(lookup=lookup):
|
||||
self.assertEqual(qs.values_list(lookup, flat=True).get(), expected)
|
||||
|
||||
def test_key_values_boolean(self):
|
||||
qs = NullableJSONModel.objects.filter(value__h=True, value__i=False)
|
||||
tests = [
|
||||
('value__h', True),
|
||||
('value__i', False),
|
||||
]
|
||||
for lookup, expected in tests:
|
||||
with self.subTest(lookup=lookup):
|
||||
self.assertIs(qs.values_list(lookup, flat=True).get(), expected)
|
||||
|
||||
@skipUnlessDBFeature('supports_json_field_contains')
|
||||
def test_key_contains(self):
|
||||
self.assertIs(NullableJSONModel.objects.filter(value__foo__contains='ar').exists(), False)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue