Django Pagination Display Issue: all the page numbers show up

房东的猫 提交于 2019-12-04 03:10:06

I have used the "Paginator Tag" with success to achieve the style of pagination you are looking for (often called "Digg-style" pagination). Usage is explained in the article "A Recipe for Pagination in Django".

I have used the following package, and it is nice and simple to use. https://github.com/jamespacileo/django-pure-pagination

It solves the common issue of not displaying every single page in the template, but rather showing a range.

The setting make such an implementation very easy:

PAGINATION_SETTINGS = {
    'PAGE_RANGE_DISPLAYED': 10,
    'MARGIN_PAGES_DISPLAYED': 2,

    'SHOW_FIRST_PAGE_WHEN_INVALID': True,
}

This is quite an old question but if someone is looking for a solution relevant to Django 1.11 and later, see https://medium.com/@sumitlni/paginate-properly-please-93e7ca776432

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!