0PricingLogin
Django Academy · Lesson

Page Controls in ListView

Add next/previous links in templates.

Pagination Built In

Good news: ListView can paginate for you. You barely write any code, and Django handles slicing the queryset into pages automatically. 🚀

Set paginate_by

Just add one attribute. Setting paginate_by tells the ListView how many items each page should show.

class ArticleList(ListView):
    model = Article
    paginate_by = 10

All lessons in this course

  1. The Paginator Class
  2. Page Controls in ListView
  3. Writing TestCase and assertions
  4. The Test Client and Fixtures
← Back to Django Academy