[Django] #37039: Outdated QuerySet.iterator() documentation

27 views
Skip to first unread message

Django

unread,
Apr 17, 2026, 1:16:28 AMApr 17
to django-...@googlegroups.com
#37039: Outdated QuerySet.iterator() documentation
-------------------------+------------------------------------------------
Reporter: Lincoln | Type: Cleanup/optimization
Status: new | Component: Documentation
Version: | 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
-------------------------+------------------------------------------------
The `QuerySet.iterator()` documentation
(https://docs.djangoproject.com/en/dev/ref/models/querysets/#iterator)
says

> (internally, the default iterator calls iterator() and caches the return
value)

I take "the default iterator" to mean the QuerySet `__iter__()` method.

This does **not** call `iterator()`:

https://github.com/django/django/blob/378481165d14fea4c2a4b7717af3d7bdf9150f08/django/db/models/query.py#L417-L433

It only calls `_fetch_all()`, which as of this change

https://github.com/django/django/commit/f3b7c059367a4e82bbfc7e4f0d42b10975e79f0c
#diff-
d58ef61559dc7af5fdf7b56fee13571a4d2948e784cd608f6afeacf3ac2fb195R1075

no longer calls `iterator()`.

So this line in the documentation is no longer accurate. I think an
appropriate fix would be to simply remove that line of quoted text from
the docs.
--
Ticket URL: <https://code.djangoproject.com/ticket/37039>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 17, 2026, 2:07:27 AMApr 17
to django-...@googlegroups.com
#37039: Outdated QuerySet.iterator() documentation
-------------------------------------+-------------------------------------
Reporter: Lincoln | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version:
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by MANAS MADESHIYA):

* cc: MANAS MADESHIYA (added)

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

Django

unread,
Apr 17, 2026, 5:22:45 AMApr 17
to django-...@googlegroups.com
#37039: Outdated QuerySet.iterator() documentation
--------------------------------------+------------------------------------
Reporter: Lincoln | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Sarah Boyce):

* stage: Unreviewed => Accepted
* version: => dev

Comment:

Thank you for the ticket and analysis. I agree we can remove the text in
the brackets
--
Ticket URL: <https://code.djangoproject.com/ticket/37039#comment:2>

Django

unread,
Apr 17, 2026, 5:29:24 AMApr 17
to django-...@googlegroups.com
#37039: Outdated QuerySet.iterator() documentation
-------------------------------------+-------------------------------------
Reporter: Lincoln | Owner: MANAS
Type: | MADESHIYA
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by MANAS MADESHIYA):

* owner: (none) => MANAS MADESHIYA
* status: new => assigned

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

Django

unread,
Apr 18, 2026, 6:49:57 AMApr 18
to django-...@googlegroups.com
#37039: Outdated QuerySet.iterator() documentation
-------------------------------------+-------------------------------------
Reporter: Lincoln | Owner: MANAS
Type: | MADESHIYA
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
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 MANAS MADESHIYA):

* cc: MANAS MADESHIYA (removed)
* has_patch: 0 => 1

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

Django

unread,
Apr 27, 2026, 4:25:37 PMApr 27
to django-...@googlegroups.com
#37039: Outdated QuerySet.iterator() documentation
-------------------------------------+-------------------------------------
Reporter: Lincoln | Owner: MANAS
Type: | MADESHIYA
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* easy: 0 => 1
* needs_better_patch: 0 => 1

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

Django

unread,
May 4, 2026, 2:28:52 PMMay 4
to django-...@googlegroups.com
#37039: Outdated QuerySet.iterator() documentation
-------------------------------------+-------------------------------------
Reporter: Lincoln | Owner: MANAS
Type: | MADESHIYA
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/37039#comment:6>

Django

unread,
May 4, 2026, 2:30:33 PMMay 4
to django-...@googlegroups.com
#37039: Outdated QuerySet.iterator() documentation
-------------------------------------+-------------------------------------
Reporter: Lincoln | Owner: MANAS
Type: | MADESHIYA
Cleanup/optimization | Status: closed
Component: Documentation | Version: dev
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: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls <jacobtylerwalls@…>):

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

Comment:

In [changeset:"7e7e9691c6029f7011179ac5948b917375f3fe4e" 7e7e969]:
{{{#!CommitTicketReference repository=""
revision="7e7e9691c6029f7011179ac5948b917375f3fe4e"
Fixed #37039 -- Removed outdated note from QuerySet.iterator() docs.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/37039#comment:7>

Django

unread,
May 4, 2026, 2:31:05 PMMay 4
to django-...@googlegroups.com
#37039: Outdated QuerySet.iterator() documentation
-------------------------------------+-------------------------------------
Reporter: Lincoln | Owner: MANAS
Type: | MADESHIYA
Cleanup/optimization | Status: closed
Component: Documentation | Version: dev
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: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jacob Walls <jacobtylerwalls@…>):

In [changeset:"990ab01e70fd8f55e867b4a234c0ee242fd33fec" 990ab01]:
{{{#!CommitTicketReference repository=""
revision="990ab01e70fd8f55e867b4a234c0ee242fd33fec"
[6.0.x] Fixed #37039 -- Removed outdated note from QuerySet.iterator()
docs.

Backport of 7e7e9691c6029f7011179ac5948b917375f3fe4e from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/37039#comment:8>
Reply all
Reply to author
Forward
0 new messages