summaryrefslogtreecommitdiff
path: root/tests/model_fields
diff options
context:
space:
mode:
Diffstat (limited to 'tests/model_fields')
-rw-r--r--tests/model_fields/test_jsonfield.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/model_fields/test_jsonfield.py b/tests/model_fields/test_jsonfield.py
index debf02517a..a56b7e74df 100644
--- a/tests/model_fields/test_jsonfield.py
+++ b/tests/model_fields/test_jsonfield.py
@@ -336,6 +336,18 @@ class TestQuerying(TestCase):
).values('value__d__0').annotate(count=Count('value__d__0')).order_by('count')
self.assertQuerysetEqual(qs, [1, 11], operator.itemgetter('count'))
+ def test_order_grouping_custom_decoder(self):
+ NullableJSONModel.objects.create(value_custom={'a': 'b'})
+ qs = NullableJSONModel.objects.filter(value_custom__isnull=False)
+ self.assertSequenceEqual(
+ qs.values(
+ 'value_custom__a',
+ ).annotate(
+ count=Count('id'),
+ ).order_by('value_custom__a'),
+ [{'value_custom__a': 'b', 'count': 1}],
+ )
+
def test_key_transform_raw_expression(self):
expr = RawSQL(self.raw_sql, ['{"x": "bar"}'])
self.assertSequenceEqual(