mirror of
https://github.com/django/django.git
synced 2025-08-02 10:02:41 +00:00
Thanks Mariusz Felisiak and Simon Charette for reviews.
This commit is contained in:
parent
e46ca51c24
commit
8b040e3cbb
14 changed files with 354 additions and 82 deletions
|
@ -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']),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue