Fixed #25284 -- Documented removal of implicit QuerySet __in lookups.
This commit is contained in:
parent
6c6eb8a691
commit
d3bc86ec11
|
@ -877,6 +877,22 @@ returned a list, but an iterator is more efficient.
|
||||||
Existing code that depends on ``list`` specific features, such as indexing,
|
Existing code that depends on ``list`` specific features, such as indexing,
|
||||||
can be ported by converting the iterator into a ``list`` using ``list()``.
|
can be ported by converting the iterator into a ``list`` using ``list()``.
|
||||||
|
|
||||||
|
Implicit ``QuerySet`` ``__in`` lookup removed
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
In earlier versions, queries such as::
|
||||||
|
|
||||||
|
Model.objects.filter(related_id=RelatedModel.objects.all())
|
||||||
|
|
||||||
|
would implicitly convert to::
|
||||||
|
|
||||||
|
Model.objects.filter(related_id__in=RelatedModel.objects.all())
|
||||||
|
|
||||||
|
resulting in SQL like ``"related_id IN (SELECT id FROM ...)"``.
|
||||||
|
|
||||||
|
This implicit ``__in`` no longer happens so the "IN" SQL is now "=", and if the
|
||||||
|
subquery returns multiple results, at least some databases will throw an error.
|
||||||
|
|
||||||
Miscellaneous
|
Miscellaneous
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue