{{{
>>> Entry.objects.values()
<QuerySet [{'blog_id': 1, 'headline': 'First Entry', ...}, ...]>
}}}
whereas the values_list() erroneously shows the return type as a straight
list:
{{{
>>> Entry.objects.values_list('id', 'headline')
[(1, 'First entry'), ...]
}}}
Simply wrapping <QuerySet> around the list shown might save others getting
as confused as I did.
--
Ticket URL: <https://code.djangoproject.com/ticket/28352>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
Ticket URL: <https://code.djangoproject.com/ticket/28352#comment:1>
* easy: 0 => 1
* stage: Unreviewed => Accepted
Old description:
> The values() documentation correctly shows the return type of the object:
>
> {{{
> >>> Entry.objects.values()
> <QuerySet [{'blog_id': 1, 'headline': 'First Entry', ...}, ...]>
> }}}
>
> whereas the values_list() erroneously shows the return type as a straight
> list:
>
> {{{
> >>> Entry.objects.values_list('id', 'headline')
> [(1, 'First entry'), ...]
> }}}
>
> Simply wrapping <QuerySet> around the list shown might save others
> getting as confused as I did.
New description:
The `values()` documentation (docs/ref/models/querysets.txt) correctly
shows the return type of the object:
{{{
>>> Entry.objects.values()
<QuerySet [{'blog_id': 1, 'headline': 'First Entry', ...}, ...]>
}}}
whereas the `values_list()` erroneously shows the return type as a list:
{{{
>>> Entry.objects.values_list('id', 'headline')
[(1, 'First entry'), ...]
}}}
Simply wrapping <QuerySet> around the list shown might save others getting
as confused as I did.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/28352#comment:2>
* owner: nobody => Irindu Indeera
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/28352#comment:3>
Comment (by Irindu Indeera ):
Hi Tim, I'd Like to work on this issue
--
Ticket URL: <https://code.djangoproject.com/ticket/28352#comment:4>
* needs_better_patch: 0 => 1
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/8732 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/28352#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"babe9e64a6172b09e7f70e8d8f01e67f2cb4176d" babe9e64]:
{{{
#!CommitTicketReference repository=""
revision="babe9e64a6172b09e7f70e8d8f01e67f2cb4176d"
Fixed #28352 -- Corrected QuerySet.values_list() return type in docs
examples.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28352#comment:6>
Comment (by Tim Graham <timograham@…>):
In [changeset:"2457c1866ef3586c56bd19aeaa554e78c1ed1875" 2457c18]:
{{{
#!CommitTicketReference repository=""
revision="2457c1866ef3586c56bd19aeaa554e78c1ed1875"
Refs #28352 -- Corrected another QuerySet.values_list() return type in
docs example.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28352#comment:7>
Comment (by Tim Graham <timograham@…>):
In [changeset:"fe7b4568255ae1f77c180404631d81ba6b2d996d" fe7b456]:
{{{
#!CommitTicketReference repository=""
revision="fe7b4568255ae1f77c180404631d81ba6b2d996d"
[1.11.x] Fixed #28352 -- Corrected QuerySet.values_list() return type in
docs examples.
Backport of babe9e64a6172b09e7f70e8d8f01e67f2cb4176d and
2457c1866ef3586c56bd19aeaa554e78c1ed1875 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28352#comment:8>