#29159: ModelChoiceIterator triggers duplicate queries when choices are cast to
list
-------------------------------------+-------------------------------------
Reporter: François Freitag | Owner: François
Type: | Freitag
Cleanup/optimization | Status: closed
Component: Forms | Version: 1.8
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 Tim Graham <timograham@…>):
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"a2e97abd8149e78071806a52282a24c27fe8236b" a2e97abd]:
{{{
#!CommitTicketReference repository=""
revision="a2e97abd8149e78071806a52282a24c27fe8236b"
Fixed #29159 -- Made ModelChoiceIterator reuse QuerySet result cache.
When __len__() is called (e.g. when casting to list or tuple), the
QuerySet is evaluated and the result cache populated. iterator()
shouldn't be called on the QuerySet after that, as it would reset the
result cache and trigger a second query.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29159#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/073.7db3d92befe81e6f87b4c5c21471c078%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.