django-tables2
1.2
  • Getting started
  • Customizing the table
    • Alternative column data
    • Alternative column ordering
    • Column attributes
    • Row attributes
    • Customizing headers and footers
    • Swapping the position of columns
    • Pagination
    • Table Mixins
    • Customizing table style
    • Querystring fields
    • Controlling localization
    • Class Based Generic Mixins
  • Reference
  • How to create a row counter?
  • How to add a footer containing a column total?
  • Upgrading and change log
  • Glossary
django-tables2
  • Docs »
  • Customizing the table »
  • Pagination
  • View page source

PaginationΒΆ

Pagination is easy, just call Table.paginate() and pass in the current page number:

def people_listing(request):
    table = PeopleTable(Person.objects.all())
    table.paginate(page=request.GET.get('page', 1), per_page=25)
    return render(request, 'people_listing.html', {'table': table})

If you’re using RequestConfig, pass pagination options to the constructor:

def people_listing(request):
    table = PeopleTable(Person.objects.all())
    RequestConfig(request, paginate={'per_page': 25}).configure(table)
    return render(request, 'people_listing.html', {'table': table})
Next Previous

© Copyright .

Built with Sphinx using a theme provided by Read the Docs.