﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
35643	Regression in Queryset sequence of value, annotate, order, value	Gert Van Gool	Simon Charette	"Testing the 5.1RC on our project, I noticed a failure in a queryset that worked before (Django 5.0.7)

I've added a test case:


{{{
diff --git i/tests/queries/tests.py w/tests/queries/tests.py
index 7ac8a65d42..c19d877ffc 100644
--- i/tests/queries/tests.py
+++ w/tests/queries/tests.py
@@ -1375,6 +1375,16 @@ class Queries1Tests(TestCase):
         self.assertCountEqual(items_after, [self.i2, self.i3, self.i4])
         self.assertCountEqual(items_before, items_after)

+    def test_values_count_value(self):
+        self.assertSequenceEqual(
+            Tag.objects.all()
+            .values(""category"")
+            .annotate(Count(""category""))
+            .order_by(""-category__count"")
+            .values_list(""category"", flat=True),
+            [self.nc1.id, None],
+        )
+

 class Queries2Tests(TestCase):
     @classmethod
}}}
"	Bug	closed	Database layer (models, ORM)	5.1	Release blocker	fixed		Gert Van Gool	Ready for checkin	1	0	0	0	0	0
