Django app that turns iterables and querysets into HTML tables with pagination and sorting. It parallels django.forms but for table views.
Overview
django-tables2 simplifies rendering collections of data as HTML tables in Django projects. Any iterable can feed a table, with dedicated support for Django querysets, and the built-in UI does not rely on JavaScript.
You define Table classes—often generated automatically from a model—and render them via template tags or class-based view mixins. Columns can be customized through subclasses, with control over headers, footers, column order, attributes on rows and cells, localization, and alternative data or ordering sources.
Pagination and per-column sorting are native features. Documentation also covers pinned rows, filtering table data, exporting rows, query-string field control, and styling options including mixins for shared table behavior.
The package is distributed on PyPI, tested against supported Django and Python versions, and documented on Read the Docs with tutorials from basic population through advanced customization.
Key features
- HTML tables from any iterable
- Queryset-oriented table support
- No JavaScript in default UI
- Model-based table generation
- Column subclass customization
- Built-in pagination
- Column sorting
- Template tag and view mixin rendering
Use cases
- List model rows in Django views
- Sortable admin-style listings
- Paginated report tables
- Export tabular query results
- Reusable table definitions in templates