mirror of
https://github.com/django/django.git
synced 2025-08-29 15:04:38 +00:00
Fixed #26056 -- Added QuerySet.values()/values_list() support for ArrayField's __overlap lookup.
Thanks Mads Jensen and kosz85 and the initial patch.
This commit is contained in:
parent
81b1c167bf
commit
fbde929b19
4 changed files with 35 additions and 1 deletions
|
@ -170,7 +170,7 @@ Returns objects where the data shares any results with the values passed. Uses
|
|||
the SQL operator ``&&``. For example::
|
||||
|
||||
>>> Post.objects.create(name='First post', tags=['thoughts', 'django'])
|
||||
>>> Post.objects.create(name='Second post', tags=['thoughts'])
|
||||
>>> Post.objects.create(name='Second post', tags=['thoughts', 'tutorial'])
|
||||
>>> Post.objects.create(name='Third post', tags=['tutorial', 'django'])
|
||||
|
||||
>>> Post.objects.filter(tags__overlap=['thoughts'])
|
||||
|
@ -179,6 +179,14 @@ the SQL operator ``&&``. For example::
|
|||
>>> Post.objects.filter(tags__overlap=['thoughts', 'tutorial'])
|
||||
<QuerySet [<Post: First post>, <Post: Second post>, <Post: Third post>]>
|
||||
|
||||
>>> Post.objects.filter(tags__overlap=Post.objects.values_list('tags'))
|
||||
<QuerySet [<Post: First post>, <Post: Second post>, <Post: Third post>]>
|
||||
|
||||
.. versionchanged:: 4.2
|
||||
|
||||
Support for ``QuerySet.values()`` and ``values_list()`` as a right-hand
|
||||
side was added.
|
||||
|
||||
.. fieldlookup:: arrayfield.len
|
||||
|
||||
``len``
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue