Fixed #32812 -- Restored immutability of named values from QuerySet.values_list().

Regression in 981a072dd4.

Thanks pirelle for the report.
This commit is contained in:
Takayuki Hirayama 2021-06-04 00:32:55 +09:00 committed by Mariusz Felisiak
parent f10c52afab
commit 0393b9262d
5 changed files with 25 additions and 2 deletions

View file

@ -309,6 +309,13 @@ class PrefetchRelatedTests(TestDataMixin, TestCase):
list(Book.objects.prefetch_related(relation))
self.assertEqual(add_q_mock.call_count, 1)
def test_named_values_list(self):
qs = Author.objects.prefetch_related('books')
self.assertCountEqual(
[value.name for value in qs.values_list('name', named=True)],
['Anne', 'Charlotte', 'Emily', 'Jane'],
)
class RawQuerySetTests(TestDataMixin, TestCase):
def test_basic(self):