Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

Django QuerySets are lazy. When is the database actually queried?

  1. A As soon as the QuerySet is defined
  2. B When the QuerySet is iterated, sliced with a step, or otherwise evaluated
  3. C Only when save() is called
  4. D At the end of the request
Answer

When the QuerySet is iterated, sliced with a step, or otherwise evaluated

Laziness allows filters to be chained without extra queries. Evaluation happens on iteration, len(), list(), bool() and similar operations.

All Django MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as