Note
Note that you can give Paginator
a list/tuple, a Django QuerySet
, or any other object with a count()
or __len__()
method. When determining the number of objects contained in the passed object, Paginator
will first try calling count()
, then fallback to using len()
if the passed object has no count()
method. This allows objects such as Django’s QuerySet
to use a more efficient count()
method when available.