summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2023-09-16 06:57:38 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-09-16 06:58:08 +0200
commitff26e6ad845e112d2ab76549ea740fb1d82d1c54 (patch)
treec7b4e7bb4659e2fa6e3fa4db73e1ce83c55629a8
parent866122690dbe233c054d06f6afbc2f3cc6aea2f2 (diff)
[4.2.x] Corrected QuerySet.prefetch_related() note about GenericRelation().
GenericRelation is a reverse generic relationship so it's always homogeneous. Mentioning this as a restriction is confusing. Backport of 88b5b7b8e56667b0f55ea6f04038b6ac77c57b98 from main
-rw-r--r--docs/ref/models/querysets.txt9
1 files changed, 5 insertions, 4 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
index d02e2173ef..e117cd5849 100644
--- a/docs/ref/models/querysets.txt
+++ b/docs/ref/models/querysets.txt
@@ -1161,10 +1161,11 @@ one-to-one.
``prefetch_related``, on the other hand, does a separate lookup for each
relationship, and does the 'joining' in Python. This allows it to prefetch
-many-to-many and many-to-one objects, which cannot be done using
-``select_related``, in addition to the foreign key and one-to-one relationships
-that are supported by ``select_related``. It also supports prefetching of
-:class:`~django.contrib.contenttypes.fields.GenericRelation` and
+many-to-many, many-to-one, and
+:class:`~django.contrib.contenttypes.fields.GenericRelation` objects which
+cannot be done using ``select_related``, in addition to the foreign key and
+one-to-one relationships that are supported by ``select_related``. It also
+supports prefetching of
:class:`~django.contrib.contenttypes.fields.GenericForeignKey`, however, it
must be restricted to a homogeneous set of results. For example, prefetching
objects referenced by a ``GenericForeignKey`` is only supported if the query