diff options
author | Christian Ledermann <christian.ledermann@gmail.com> | 2018-06-16 20:53:54 +0100 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2018-06-16 15:54:10 -0400 |
commit | d28360aa48e40af43450dcdd3843fe7b197b898c (patch) | |
tree | 2df612b10b0ba3ebf59ae90db7b3a7085a7fecd0 | |
parent | d03b130cbcc629daa5ae767588b2fff41ea1e48a (diff) | |
download | django-d28360aa48e40af43450dcdd3843fe7b197b898c.tar.gz |
[2.1.x] Refs #29493 -- Doc'd that the QuerySet in lookup accepts a string.
Backport of 11bfe3a83d79c832bd861b6b87f254197fde1659 from master
-rw-r--r-- | docs/ref/models/querysets.txt | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index b2f430d7bc..b18f5ab3e6 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -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:: |