When Querysets Are Evaluated?
Evaluated. Internally, a Queryset Can Be Constructed, Filtered, Sliced, and Generally Passed Around Without Actually Hitting the Database. No Database Activity...
When QuerySet s are evaluated. Internally, a QuerySet can be constructed, filtered, sliced, and generally passed around without actually hitting the database. No database activity actually occurs until you do something to evaluate the queryset.
How does Django QuerySet work?
A django queryset is like its name says, basically a collection of (sql) queries, in your example above print(b. query) will show you the sql query generated from your django filter calls. Since querysets are lazy, the database query isn't done immediately, but only when needed - when the queryset is evaluated.
Does Values_list evaluate QuerySet?
len() : A QuerySet is evaluated when you call len() on it. This, as you might expect, returns the length of the result list. list() : Force evaluation of a QuerySet by calling list() on it.