Home »
Python »
Django MCQs
In Django QuertSet, which method is used to filter your search?
32. In Django QuertSet, which method is used to filter your search?
- filter()
- search()
- filter_all()
- filter_values()
Answer: A) filter()
Explanation:
In Django QuertSet, the filter() method is used to filter your search and returns the rows only that match the search query. Consider the below code statement –
dataObj = students.objects.filter(class='B.tech').values()
Where, "students" is the model name, and "class" is the column name. The above statement will return only matched rows.