values_list doesn't give the full object when requested
|Reported by:||Kenneth Arnold||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Cc:||kenneth.arnold@…||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
values_list is very useful to us, but one thing that keeps it from being more useful is that it will not return full objects when we ask for them.
Model.objects.values_list('other') # yields ids
Model.objects.values_list('other_id') # yields ids Model.objects.values_list('other') # yields objects
This of course requires getting extra things from the database, akin to
select_related. We prefer
values_list because it is more explicit and doesn't require pulling in all the fields of the first model (
Model, above) where we don't ask for them.