Getting started¶
Install¶
Editable install for local development:
With uv, override PyPI in your project:
[project]
dependencies = ["django-grid-view>=1.0.0"]
[tool.uv.sources]
django-grid-view = { path = "../django-grid-view", editable = true }
Django setup¶
# urls.py
from django.urls import include, path
urlpatterns = [
path("", include("django_grid_view.urls")),
]
This creates the GridPreference model used for per-user column presets and saved searches (optional; required if you use the save API).
Load assets once per page¶
Grid View inclusion tags auto-load CSS/JS on first use. For explicit control:
Place {% grid_view_bundle %} in your base template, or rely on auto-load from render_simple_table, render_grid_view, etc.
First Simple Table¶
View — build rows in Python:
from django.shortcuts import render
from django_grid_view.tables import Column, SimpleTableConfig
def doctors_list(request):
rows = [
{"name": "Ada", "visits": 12},
{"name": "Bob", "visits": 8},
]
config = SimpleTableConfig(
grid_id="doctors",
columns=[
Column(key="name", label="Doctor"),
Column(key="visits", label="Visits", align="right"),
],
data=rows,
)
return render(request, "doctors.html", {"table": config})
Template:
Open the page — client-side sort and search work without extra JavaScript.
Typing in host projects¶
The package includes py.typed. Import contracts instead of copying TypedDicts:
from django_grid_view.types import GridViewSpec, GridViewSpecWire, JsonObject, RowDict
from django_grid_view.tables import Column, SimpleTableConfig
from django_grid_view.render import build_artifact_from_view, parse_grid_view_spec
See Python types for wire types, GridArtifactJson, enums, and pyright setup.
Next steps¶
- Simple Table — columns, export, footers
- AG-Grid integration — HTMX-safe grids and preferences
- Charts and KPIs — ECharts and KPI strips
- Grid View artifacts — unified
GridViewSpecrendering