#23623: ModelChoiceField generates unused temporary cache
-------------------------------------+-------------------------------------
     Reporter:  tchaumeny            |                    Owner:  nobody
         Type:                       |                   Status:  closed
  Cleanup/optimization               |
    Component:  Forms                |                  Version:  master
     Severity:  Normal               |               Resolution:  fixed
     Keywords:  ModelChoiceField,    |             Triage Stage:
  admin                              |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by charettes):

 It looks like this introduced a regression when passing a queryset using
 the `prefetch_related()` which is not compatible with `iterator()` by
 design #25496.

 I would suggest we conditionally use `iterator()` if no related data
 should be fetched instead of simply reverting this optimization.
 Unfortunately there's no public API to determine whether or not a
 `QuerySet` is prefetching data and we would have to rely on the
 `qs._prefetch_related_lookups` property.

--
Ticket URL: <https://code.djangoproject.com/ticket/23623#comment:6>
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/067.76921e651a14aed9f7ec7a88e620ed40%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to