In Django QuertSet, which method is used to filter your search?

32. In Django QuertSet, which method is used to filter your search?

  1. filter()
  2. search()
  3. filter_all()
  4. 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.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.