1
0
mirror of https://github.com/django/django.git synced 2025-04-06 22:46:41 +00:00

[2.1.x] Refs #29493 -- Doc'd that the QuerySet in lookup accepts a string.

Backport of 11bfe3a83d79c832bd861b6b87f254197fde1659 from master
This commit is contained in:
Christian Ledermann 2018-06-16 20:53:54 +01:00 committed by Tim Graham
parent d03b130cbc
commit d28360aa48

View File

@ -2642,15 +2642,18 @@ SQL equivalent::
``in``
~~~~~~
In a given iterable; often a list, tuple, or queryset.
In a given iterable; often a list, tuple, or queryset. It's not a common use
case, but strings (being iterables) are accepted.
Example::
Examples::
Entry.objects.filter(id__in=[1, 3, 4])
Entry.objects.filter(headline__in='abc')
SQL equivalent::
SQL equivalents::
SELECT ... WHERE id IN (1, 3, 4);
SELECT ... WHERE headline IN ('a', 'b', 'c');
You can also use a queryset to dynamically evaluate the list of values
instead of providing a list of literal values::