From 3990d740180bc49a1479b8a2918b0878df65518a Mon Sep 17 00:00:00 2001 From: AK Date: Sat, 24 Mar 2018 12:45:09 -0400 Subject: Added a pagination example to ListView docs. --- docs/ref/class-based-views/generic-display.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs/ref') diff --git a/docs/ref/class-based-views/generic-display.txt b/docs/ref/class-based-views/generic-display.txt index 8ebe871685..15d3351d48 100644 --- a/docs/ref/class-based-views/generic-display.txt +++ b/docs/ref/class-based-views/generic-display.txt @@ -115,6 +115,7 @@ many projects they are typically the most commonly used views. class ArticleListView(ListView): model = Article + paginate_by = 100 # if pagination is desired def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) @@ -144,6 +145,10 @@ many projects they are typically the most commonly used views. {% endfor %} + If you're using pagination, you can adapt the :ref:`example template from + the pagination docs `. Change instances of + ``contacts`` in that example template to ``page_obj``. + .. class:: django.views.generic.list.BaseListView A base view for displaying a list of objects. It is not intended to be used -- cgit v1.3