Fixed #29789 -- Added support for nested relations to FilteredRelation.

This commit is contained in:
matt ferrante 2020-01-06 16:44:32 -07:00 committed by Mariusz Felisiak
parent 5a3d7cf462
commit 7d6916e827
5 changed files with 336 additions and 39 deletions

View file

@ -3707,17 +3707,10 @@ operate on vegetarian pizzas.
``FilteredRelation`` doesn't support:
* Conditions that span relational fields. For example::
>>> Restaurant.objects.annotate(
... pizzas_with_toppings_startswith_n=FilteredRelation(
... 'pizzas__toppings',
... condition=Q(pizzas__toppings__name__startswith='n'),
... ),
... )
Traceback (most recent call last):
...
ValueError: FilteredRelation's condition doesn't support nested relations (got 'pizzas__toppings__name__startswith').
* :meth:`.QuerySet.only` and :meth:`~.QuerySet.prefetch_related`.
* A :class:`~django.contrib.contenttypes.fields.GenericForeignKey`
inherited from a parent model.
.. versionchanged:: 3.2
Support for nested relations was added.