Opened 7 years ago
Last modified 7 years ago
#28352 closed Cleanup/optimization
values_list documentation doesn't show return type which can be confusing — at Initial Version
Reported by: | Rich Elmes | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.11 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | yes | UI/UX: | no |
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.
Note:
See TracTickets
for help on using tickets.