diff options
author | David Sanders <shang.xiao.sanders@gmail.com> | 2023-03-28 16:45:46 +1100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-04-20 08:37:29 +0200 |
commit | 0494efddc422716431b92896899284b6afebb23a (patch) | |
tree | 3c83b6a669b021dc99727b2073423b2048aafc93 /docs | |
parent | 2a577853639a5f2ca14822acc593104f2846597c (diff) | |
download | django-0494efddc422716431b92896899284b6afebb23a.tar.gz |
Fixed #34440 -- Doc'd that & queryset operator works similar to chaining.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/ref/models/querysets.txt | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 65fe805b2e..50714114fc 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -1983,15 +1983,13 @@ Combined querysets must use the same model. AND (``&``) ~~~~~~~~~~~ -Combines two ``QuerySet``\s using the SQL ``AND`` operator. +Combines two ``QuerySet``\s using the SQL ``AND`` operator in a manner similar +to chaining filters. The following are equivalent:: Model.objects.filter(x=1) & Model.objects.filter(y=2) - Model.objects.filter(x=1, y=2) - from django.db.models import Q - - Model.objects.filter(Q(x=1) & Q(y=2)) + Model.objects.filter(x=1).filter(y=2) SQL equivalent: |