[Django] #28765: Documentation __In lookup

12 views
Skip to first unread message

Django

unread,
Nov 2, 2017, 9:50:41 AM11/2/17
to django-...@googlegroups.com
#28765: Documentation __In lookup
-------------------------------------+-------------------------------------
Reporter: Дилян | Owner: nobody
Палаузов |
Type: | Status: new
Cleanup/optimization |
Component: Database | Version: 1.11
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Clarify, that [two underscores]in accepts any iterable (e.g. dict.keys())
{{{
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
--- a/docs/ref/models/querysets.txt
+++ b/docs/ref/models/querysets.txt
@@ -2520,7 +2520,7 @@ SQL equivalent::
``in``
~~~~~~

-In a given list.
+In a given iterable.

Example::

}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28765>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 2, 2017, 10:19:52 AM11/2/17
to django-...@googlegroups.com
#28765: Clarify the documentation about what types the __in lookup accepts
--------------------------------------+------------------------------------
Reporter: Дилян Палаузов | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

* component: Database layer (models, ORM) => Documentation
* stage: Unreviewed => Accepted


Comment:

I'm not sure if "iterable" is the best term. For example, a string is
iterable but isn't accepted.

--
Ticket URL: <https://code.djangoproject.com/ticket/28765#comment:1>

Django

unread,
Nov 2, 2017, 11:10:58 AM11/2/17
to django-...@googlegroups.com
#28765: Clarify the documentation about what types the __in lookup accepts
--------------------------------------+------------------------------------
Reporter: Дилян Палаузов | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Дилян Палаузов):

String is accepted, at least with Postgresql. E.g. when a column consists
of a single letter {{{x = models.Char(max_char=1, default='A')}}} then
{{{...objects.filter(x__in='ABC')}}} is valid.

--
Ticket URL: <https://code.djangoproject.com/ticket/28765#comment:2>

Django

unread,
Nov 2, 2017, 2:01:03 PM11/2/17
to django-...@googlegroups.com
#28765: Clarify the documentation about what types the __in lookup accepts
--------------------------------------+------------------------------------
Reporter: Дилян Палаузов | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Tim Graham):

You're correct, but that generates `WHERE x IN (A, B, C)` which I don't
think is intuitive.

--
Ticket URL: <https://code.djangoproject.com/ticket/28765#comment:3>

Django

unread,
Nov 2, 2017, 2:27:14 PM11/2/17
to django-...@googlegroups.com
#28765: Clarify the documentation about what types the __in lookup accepts
--------------------------------------+------------------------------------
Reporter: Дилян Палаузов | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Дилян Палаузов):

The SQL generated is correct for the case. I find it also intuitive, as
this is also what I would have expected.

Back to he original question: are there any reason against clarifying that
the _in lookup accepts iterables of any kind, not just lists?

--
Ticket URL: <https://code.djangoproject.com/ticket/28765#comment:4>

Django

unread,
Nov 3, 2017, 8:29:33 PM11/3/17
to django-...@googlegroups.com
#28765: Clarify the documentation about what types the __in lookup accepts
--------------------------------------+------------------------------------
Reporter: Дилян Палаузов | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/9326 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/28765#comment:5>

Django

unread,
Nov 6, 2017, 1:12:38 PM11/6/17
to django-...@googlegroups.com
#28765: Clarify the documentation about what types the __in lookup accepts
--------------------------------------+------------------------------------
Reporter: Дилян Палаузов | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.11
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by GitHub <noreply@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"5587485d49af8b32ab660854f751a234baa6610b" 5587485d]:
{{{
#!CommitTicketReference repository=""
revision="5587485d49af8b32ab660854f751a234baa6610b"
Fixed #28765 -- Clarified docs about what types the __in lookup accepts.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28765#comment:6>

Django

unread,
Nov 6, 2017, 1:13:19 PM11/6/17
to django-...@googlegroups.com
#28765: Clarify the documentation about what types the __in lookup accepts
--------------------------------------+------------------------------------
Reporter: Дилян Палаузов | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.11
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"bcaef2c91d234fe742973eb7df8a47f2048d3e63" bcaef2c9]:
{{{
#!CommitTicketReference repository=""
revision="bcaef2c91d234fe742973eb7df8a47f2048d3e63"
[2.0.x] Fixed #28765 -- Clarified docs about what types the __in lookup
accepts.

Backport of 5587485d49af8b32ab660854f751a234baa6610b from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28765#comment:7>

Reply all
Reply to author
Forward
0 new messages