Opened 14 years ago
Closed 14 years ago
#16013 closed Bug (invalid)
ModelChoiceIterator unnecessarly clone queryset
Reported by: | 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: | no |
Description
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.
Note:
See TracTickets
for help on using tickets.
This is by design. If a new clone isn't made, then the choices would never change after a form class has been created.