mirror of https://github.com/django/django.git
[1.9.x] Fixed #21422 -- Documented that prefetch_related() results must be homogeneous.
Backport of 69239c0f96
from master
This commit is contained in:
parent
8b92839769
commit
31a51a04e8
|
@ -884,7 +884,10 @@ 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
|
``select_related``, in addition to the foreign key and one-to-one relationships
|
||||||
that are supported by ``select_related``. It also supports prefetching of
|
that are supported by ``select_related``. It also supports prefetching of
|
||||||
:class:`~django.contrib.contenttypes.fields.GenericRelation` and
|
:class:`~django.contrib.contenttypes.fields.GenericRelation` and
|
||||||
:class:`~django.contrib.contenttypes.fields.GenericForeignKey`.
|
: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
|
||||||
|
is restricted to one ``ContentType``.
|
||||||
|
|
||||||
For example, suppose you have these models::
|
For example, suppose you have these models::
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue