1. Home
  2. Computer Science MCQs
  3. Django
  4. Which method is used to filter query results based on…

Added 28 Apr 2024

Which method is used to filter query results based on certain conditions in Django?

  1. get()
  2. filter() Correct answer
  3. exclude()
  4. all()

Correct answer

B. filter()

13 views

MCQSEXAM

Explanation

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.

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Django MCQs

Practise all Django MCQs

Similar MCQs