Opened 4 years ago

Closed 4 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:

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.

Change History (1)

comment:1 Changed 4 years ago by mattmcc

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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