Document/make public prefetch_related_objects

88 views
Skip to first unread message

Adam Johnson

unread,
Aug 14, 2015, 8:26:36 AM8/14/15
to Django developers (Contributions to Django itself)
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 on my project fine. Could prefetch_related_objects be documented as a part of Django's public API, or are there arguments against it?

Marc Tamlyn

unread,
Aug 14, 2015, 9:20:33 AM8/14/15
to django-d...@googlegroups.com
Nothing on `query` is public at the moment - I can see the merit in adding a public API to do this kind of work though. Can you open a ticket? https://code.djangoproject.com/newticket

On 14 August 2015 at 13:26, Adam Johnson <djch...@gmail.com> wrote:
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 on my project fine. Could prefetch_related_objects be documented as a part of Django's public API, or are there arguments against it?

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/c7634422-6d72-4f83-ada3-d2a0cce099e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adam Johnson

unread,
Aug 15, 2015, 8:12:46 AM8/15/15
to django-d...@googlegroups.com

--
You received this message because you are subscribed to a topic in the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-developers/xjxKnhEDl7s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-develop...@googlegroups.com.

To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.

For more options, visit https://groups.google.com/d/optout.



--
Adam
Reply all
Reply to author
Forward
0 new messages