#28352: QuerySet.values_list() docs documentation doesn't show correct return 
type
--------------------------------------+------------------------------------
     Reporter:  Rich Elmes            |                    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:  1                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

 * 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>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.b1fde86cdb063ffbadf724f4205b9951%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to