1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Added a pagination example to ListView docs.

This commit is contained in:
AK
2018-03-24 12:45:09 -04:00
committed by Tim Graham
parent 4554f9a783
commit 3990d74018
2 changed files with 9 additions and 1 deletions

View File

@@ -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 %}
</ul>
If you're using pagination, you can adapt the :ref:`example template from
the pagination docs <using-paginator-in-view>`. 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