mirror of https://github.com/django/django.git
[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 88b5b7b8e5
from main
This commit is contained in:
parent
866122690d
commit
ff26e6ad84
|
@ -1161,10 +1161,11 @@ one-to-one.
|
||||||
|
|
||||||
``prefetch_related``, on the other hand, does a separate lookup for each
|
``prefetch_related``, on the other hand, does a separate lookup for each
|
||||||
relationship, and does the 'joining' in Python. This allows it to prefetch
|
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
|
many-to-many, many-to-one, and
|
||||||
``select_related``, in addition to the foreign key and one-to-one relationships
|
:class:`~django.contrib.contenttypes.fields.GenericRelation` objects which
|
||||||
that are supported by ``select_related``. It also supports prefetching of
|
cannot be done using ``select_related``, in addition to the foreign key and
|
||||||
:class:`~django.contrib.contenttypes.fields.GenericRelation` and
|
one-to-one relationships that are supported by ``select_related``. It also
|
||||||
|
supports prefetching of
|
||||||
:class:`~django.contrib.contenttypes.fields.GenericForeignKey`, however, it
|
:class:`~django.contrib.contenttypes.fields.GenericForeignKey`, however, it
|
||||||
must be restricted to a homogeneous set of results. For example, prefetching
|
must be restricted to a homogeneous set of results. For example, prefetching
|
||||||
objects referenced by a ``GenericForeignKey`` is only supported if the query
|
objects referenced by a ``GenericForeignKey`` is only supported if the query
|
||||||
|
|
Loading…
Reference in New Issue