Which method is used to filter query results based on certain conditions in Django?
Correct answer
B. filter()
13 views
B. filter()
13 views
filter() returns a QuerySet of the objects that match the given conditions: Book.objects.filter(price__lt=500).
exclude() returns those that do not match, get() returns exactly one object, and all() returns everything.
Keep preparing with more Computer Science MCQs on MCQsExam.com.
Not sure why the answer is B? Ask here and get an explanation.