Home »
Python »
Django MCQs
In Django QuertSet, which method is used to get the specified column?
31. In Django QuertSet, which method is used to get the specified column?
- column_values()
- columnvalues()
- values_list()
- column_list()
Answer: C) values_list()
Explanation:
In Django QuertSet, the values_list() method is used to get the specified column. Consider the below code statement –
dataObj = students.objects.values_list('class')
Where, "students" is the model name, and "class" is the column name.