[Django] #36614: Deprecate QuerySet.values_list(flat=True) with no fields

4 views
Skip to first unread message

Django

unread,
Sep 17, 2025, 5:37:15 AMSep 17
to django-...@googlegroups.com
#36614: Deprecate QuerySet.values_list(flat=True) with no fields
-------------------------------------+-------------------------------------
Reporter: Adam Johnson | Type:
| Cleanup/optimization
Status: new | Component: Database
| layer (models, ORM)
Version: dev | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
In #36606, this case was optimized, but it was also agreed we can
deprecate it. Using `values_list(flat=True)` doesn’t clearly declare which
fields to fetch, and while it happens to select the PK due to field
ordering, that’s unclear. It's also a bit counterintuitive, compared to
calls without `flat=True`, which select *all* fields.
--
Ticket URL: <https://code.djangoproject.com/ticket/36614>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 17, 2025, 6:00:53 AMSep 17
to django-...@googlegroups.com
#36614: Deprecate QuerySet.values_list(flat=True) with no fields
-------------------------------------+-------------------------------------
Reporter: Adam Johnson | Owner: Adam
Type: | Johnson
Cleanup/optimization | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Adam Johnson):

* has_patch: 0 => 1
* owner: (none) => Adam Johnson
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/36614#comment:1>

Django

unread,
Sep 17, 2025, 6:16:58 AMSep 17
to django-...@googlegroups.com
#36614: Deprecate QuerySet.values_list(flat=True) with no fields
-------------------------------------+-------------------------------------
Reporter: Adam Johnson | Owner: Adam
Type: | Johnson
Cleanup/optimization | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Unreviewed => Accepted

--
Ticket URL: <https://code.djangoproject.com/ticket/36614#comment:2>

Django

unread,
Sep 19, 2025, 6:39:33 AM (12 days ago) Sep 19
to django-...@googlegroups.com
#36614: Deprecate QuerySet.values_list(flat=True) with no fields
-------------------------------------+-------------------------------------
Reporter: Adam Johnson | Owner: Adam
Type: | Johnson
Cleanup/optimization | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36614#comment:3>

Django

unread,
Sep 29, 2025, 5:34:15 AM (2 days ago) Sep 29
to django-...@googlegroups.com
#36614: Deprecate QuerySet.values_list(flat=True) with no fields
-------------------------------------+-------------------------------------
Reporter: Adam Johnson | Owner: Adam
Type: | Johnson
Cleanup/optimization | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Adam Johnson):

* needs_better_patch: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36614#comment:4>

Django

unread,
Sep 29, 2025, 9:56:51 AM (2 days ago) Sep 29
to django-...@googlegroups.com
#36614: Deprecate QuerySet.values_list(flat=True) with no fields
-------------------------------------+-------------------------------------
Reporter: Adam Johnson | Owner: Adam
Type: | Johnson
Cleanup/optimization | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/36614#comment:5>

Django

unread,
Sep 30, 2025, 2:46:40 AM (yesterday) Sep 30
to django-...@googlegroups.com
#36614: Deprecate QuerySet.values_list(flat=True) with no fields
-------------------------------------+-------------------------------------
Reporter: Adam Johnson | Owner: Adam
Type: | Johnson
Cleanup/optimization | Status: closed
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce <42296566+sarahboyce@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"8b241f84e25f679c459393dab2947c8354eb01a9" 8b241f8]:
{{{#!CommitTicketReference repository=""
revision="8b241f84e25f679c459393dab2947c8354eb01a9"
Fixed #36614 -- Deprecated QuerySet.values_list(flat=True) without a
field.

Thanks to Jacob Walls and Simon Charette for their input.

co-authored-by: Sarah Boyce <42296566+...@users.noreply.github.com>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36614#comment:6>
Reply all
Reply to author
Forward
0 new messages