Django Tutorial · QuerySets
QuerySet Get
Learn all about QuerySet Get in this comprehensive tutorial.
5 min read intermediate
- •There are different methods to get data from a model into a QuerySet.
- •The values() method allows you to return each object as a Python dictionary, with the names and values as key/value pairs:
- •The values_list() method allows you to return only the columns that you specify.
- •You can filter the search to only return specific rows/records, by using the filter() method.
Get Data
There are different methods to get data from a model into a QuerySet.
The values() Method
The values() method allows you to return each object as a Python dictionary, with the names and values as key/value pairs:
Return Specific Columns
The values_list() method allows you to return only the columns that you specify.
Return Specific Rows
You can filter the search to only return specific rows/records, by using the filter() method.
You will learn more about the filter() method in the next chapter.
Module quiz
2 questions1
Which of the following is true about QuerySet Get?
2
What is the most common pitfall when working with QuerySet Get?
Answer all questions to submit.