mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Thanks Mariusz Felisiak and Simon Charette for reviews.
This commit is contained in:
committed by
Mariusz Felisiak
parent
e46ca51c24
commit
8b040e3cbb
@@ -2,7 +2,7 @@ import json
|
||||
|
||||
from django.core import checks, exceptions, serializers
|
||||
from django.db import connection
|
||||
from django.db.models import OuterRef, Subquery
|
||||
from django.db.models import F, OuterRef, Subquery
|
||||
from django.db.models.expressions import RawSQL
|
||||
from django.forms import Form
|
||||
from django.test.utils import CaptureQueriesContext, isolate_apps
|
||||
@@ -137,6 +137,13 @@ class TestQuerying(PostgreSQLTestCase):
|
||||
self.objs[:2]
|
||||
)
|
||||
|
||||
def test_key_transform_annotation(self):
|
||||
qs = HStoreModel.objects.annotate(a=F('field__a'))
|
||||
self.assertCountEqual(
|
||||
qs.values_list('a', flat=True),
|
||||
['b', 'b', None, None, None],
|
||||
)
|
||||
|
||||
def test_keys(self):
|
||||
self.assertSequenceEqual(
|
||||
HStoreModel.objects.filter(field__keys=['a']),
|
||||
|
||||
Reference in New Issue
Block a user