what’s the difference between using:
Blabla.objects.values('field1', 'field2', 'field3')
and
Blabla.objects.only('field1', 'field2', 'field3')
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming
Blablahas the fields in your question, as well asfield4,will return the value of that object’s
field4(with a new database query to retrieve that info), whereaswill give
This is because
.values()returns aQuerySetthat returns dictionaries, which is essentially a list of dicts, rather than model instances (Blabla).