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

Refs #34060 -- Fixed crash when filtering against literal JSON with psycopg2.

This commit is contained in:
Simon Charette
2024-02-15 21:48:42 -05:00
committed by Mariusz Felisiak
parent c991602ce5
commit 0d8fbe2ade
3 changed files with 21 additions and 10 deletions

View File

@@ -1120,3 +1120,10 @@ class TestQuerying(TestCase):
KT("value")
with self.assertRaisesMessage(ValueError, msg):
KT("")
def test_literal_annotation_filtering(self):
all_objects = NullableJSONModel.objects.order_by("id")
qs = all_objects.annotate(data=Value({"foo": "bar"}, JSONField())).filter(
data__foo="bar"
)
self.assertQuerySetEqual(qs, all_objects)