diff --git a/docs/topics/db/queries.txt b/docs/topics/db/queries.txt index 7c6c9e18ac..84fbfabe45 100644 --- a/docs/topics/db/queries.txt +++ b/docs/topics/db/queries.txt @@ -1802,6 +1802,18 @@ methods:: b.entry_set(manager="entries").is_published() +.. admonition:: Interaction with prefetching + + When calling :meth:`~django.db.models.query.QuerySet.prefetch_related` with + a reverse relation, the default manager will be used. If you want to + prefetch related objects using a custom reverse manager, use + :class:`Prefetch() `. For example:: + + from django.db.models import Prefetch + + prefetch_manager = Prefetch("entry_set", queryset=Entry.entries.all()) + Blog.objects.prefetch_related(prefetch_manager) + Additional methods to handle related objects ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~