django-tables2
Table/data-grid framework for Django
What it is and what it does
django-tables2 is a Django app that converts querysets and other iterables into rendered HTML tables with minimal boilerplate. It works by defining a Table subclass that declares columns and metadata, then passing that table class to a view mixin or template tag. The package handles pagination, column sorting, and template rendering without requiring JavaScript, and supports automatic table generation from Django models.
The package is designed for developers who need to display tabular data in Django templates. It reduces repetitive HTML generation and provides a declarative, model-like syntax familiar to Django users. It works with any iterable data source but has special integration with Django querysets, making it particularly useful for displaying database results with sorting and pagination controls.
Use it for:
- Display a Django model's records in a paginated, sortable HTML table in an admin-like interface
- Generate data grids from filtered querysets with automatic column rendering and pagination
- Build custom table layouts by subclassing Table and defining column types and behaviors
- Render querysets in templates without writing raw HTML loops or manual pagination logic
- Create sortable, paginated reports from any iterable data source in a Django view
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
django-tables2 generates HTML tables from Django querysets and other iterables, with built-in pagination and column sorting, similar to how django.forms handles form generation.
Yes. django-tables2 is actively maintained, has no known vulnerabilities, carries a permissive BSD license, and solves a common Django problem with low install friction. It is well-suited for any Django project that needs to display tabular data with pagination and sorting.
Install
django-tables2 on PyPI
pip
pip install django-tables2uv
uv add django-tables2poetry
poetry add django-tables2Installing django-tables2
Before you install
Low install friction with a single runtime dependency (django). Active maintenance with a recent release (123 days ago) and ongoing repository activity.
License in practice
BSD license (permissive). You may use, modify, and distribute the package freely in commercial and private projects, provided you retain the license notice.
Quickstart
# Install
pip install django-tables2
# In settings.py
INSTALLED_APPS = (..., "django_tables2")
# Define a table
import django_tables2 as tables
class MyTable(tables.Table):
class Meta:
model = MyModel
# In a view
class MyTableView(tables.SingleTableView):
table_class = MyTable
queryset = MyModel.objects.all()
# In template
{% load django_tables2 %}
{% render_table table %}
Requires Django and Python 3.10 or later; the package must be added to INSTALLED_APPS for template tags to work.
Verify before relying
- Whether the package supports Django 5.2 and 6.0 in practice or only declares compatibility
- Performance characteristics with large querysets or complex custom columns
Package facts
| License | All changes made to django-tables2 since forking from django-tables are Copyright (c) 2011, Bradley Ayers <http://bradleyayers.com> All rights reserved. Redistribution is permitted under the same… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — django |
| Maintenance | actively maintained — 123 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,017,635/month — #4,498 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_tables2-3.0.0-py3-none-any.whl
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
dj-datatables-viewProvides a Django base view for server-side…
permissive · top 15,000 on PyPI
django-datatables-viewProvides a Django view base class that handles…
permissive · top 15,000 on PyPI
django-cursor-paginationImplements cursor-based pagination for Django…
permissive · top 15,000 on PyPI
django-select2Provides custom autocomplete form fields for…
permissive · top 15,000 on PyPI
django-queryset-csvExports Django QuerySet data to CSV format with…
copyleft · top 15,000 on PyPI
django-chunkatorIterates over large Django QuerySets in…
permissive · top 15,000 on PyPI
django-query-builderBuilds and executes complex SQL queries…
permissive · top 15,000 on PyPI
django-ordered-modelAdds ordering and reordering capabilities to…
permissive · top 15,000 on PyPI
djangorestframework-datatablesAdds server-side Datatables support to Django…
permissive · top 15,000 on PyPI