Opened 7 years ago

Closed 7 years ago

#16013 closed Bug (invalid)

ModelChoiceIterator unnecessarly clone queryset

Reported by: maksymus007@… Owned by: nobody
Component: Forms Version: 1.3
Severity: Normal Keywords: ModelChoiceIterator
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX:


ModelChoiceField gets queryset as an init argument and uses ModelChoiceIterator for populating choices. Iterator than calls queryset.all() which makes an unnecessary clone of QS - making its cached data go away and issuing new database query if a queryset has been evaluated before.

Change History (1)

comment:1 Changed 7 years ago by Matt McClanahan

Resolution: invalid
Status: newclosed

This is by design. If a new clone isn't made, then the choices would never change after a form class has been created.

Note: See TracTickets for help on using tickets.
Back to Top