#25279: Make prefetch_related_objects a public API
-------------------------------------+-------------------------------------
     Reporter:  adamchainz           |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  1.8
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by timgraham:

Old description:

> `prefetch_related` is great, but it would be nice to be able to reuse its
> capabilities with lists of model instances already retrieved by other
> code (or from cache, or newly constructed, etc.). It seems this is
> possible by using `django.db.models.query.prefetch_related_objects` which
> is the function implementing all the prefetch capability - I've just seen
> it used fine, however it is not part of Django's public API.
>
> As far as I can tell, just doing an `import` in
> `django.db.models.__init__` and adding documentation should be enough to
> make it public, since `prefetch_related_objects` contains all the
> functionality that `prefetch_related` exposes.

New description:

 `prefetch_related` is great, but it would be nice to be able to reuse its
 capabilities with lists of model instances already retrieved by other code
 (or from cache, or newly constructed, etc.). It seems this is possible by
 using `django.db.models.query.prefetch_related_objects` which is the
 function implementing all the prefetch capability - I've just seen it used
 fine, however it is not part of Django's public API.

 As far as I can tell, just doing an `import` in
 `django.db.models.__init__` and adding documentation should be enough to
 make it public, since `prefetch_related_objects` contains all the
 functionality that `prefetch_related` exposes.

 [https://groups.google.com/d/topic/django-
 developers/xjxKnhEDl7s/discussion django-developers discussion]

--

--
Ticket URL: <https://code.djangoproject.com/ticket/25279#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/068.ac09017796728831e0b3748dc60786aa%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to