Skip to main content

django-admin-list-charts

Useful charts for Django admin, from one mixin.

Visits, timeline only

Visits, counts enabled

@admin.register(Order)
class OrderAdmin(ListChartMixin, admin.ModelAdmin):
    pass

Charts appear above the admin list controls and follow search and filters across all results. The initial view shows only the timeline. Django’s Show counts enables boolean rate overlays and standard distributions. On wide containers the timeline takes at least two-thirds of the width, with compact distributions stacked beside it and overflow directly below. Narrow containers stack distributions below the timeline. The plot remains 216px high; enabled distributions can increase the total layout height. Light, dark and automatic themes work without configuration. Use arrow keys on a focused chart to explore points and Enter to filter.

See the gallery for desktop and mobile examples in light and dark mode.

Quick start

python -m pip install .

For a local checkout, use the command above. After release, 0.5.1 can be installed with python -m pip install django-admin-list-charts==0.5.1.

Add 'admin_list_charts' to INSTALLED_APPS, then mix it into an admin:

from django.contrib import admin
from admin_list_charts.admin import ListChartMixin
from .models import Order

@admin.register(Order)
class OrderAdmin(ListChartMixin, admin.ModelAdmin):
    pass

Use your project's usual static-file deployment, including collectstatic. Chart.js and styles ship in the wheel. Runtime requires Django only; consumers need no Node, CDN, date adapter, migrations, or chart settings.

What happens automatically

The timeline uses an existing date_hierarchy, or prefers created_at, created, date_created, date_joined, published_at, published, then timestamp. Otherwise it uses a sole eligible date field. Modification fields and auto_now fields are excluded from inference. Ambiguous or absent dates leave distributions available when counts are enabled. Inference never changes date_hierarchy or adds Django date navigation.

With counts enabled, up to two booleans become timeline rate overlays. Up to three choice/boolean fields become distributions, preferring the request's get_list_filter(request), followed by model choices and booleans. Single-valued related paths such as company__source and company__active work. Free text, identifiers, unrestricted relations, and multi-valued paths require explicit configuration. Numeric metrics and top-N extras are not supported.

Initial chart rendering uses one timeline aggregation query, or zero for an empty selection or a model without an eligible date. Django’s effective counts policy (ALLOW, ALWAYS, or NEVER) controls the overlays and distributions. Selection is deterministic. Empty and constant automatic charts are suppressed using their collected results; no replacement-candidate queries run. Default distributions show at most six categories. Long histories coarsen to at most 240 timeline buckets, with missing counts filled with zero and unknown rates left as gaps. Nullable booleans are excluded from rate denominators.

Chart labels omit a leading chart prefix and start with a capital letter.

Examples

python -m pip install -e .
python example_project/manage.py migrate
python example_project/manage.py seed_demo --reset --preset small --seed 42 --reference-date 2026-10-01
python example_project/manage.py createsuperuser
python example_project/manage.py runserver

Open /admin/. Visits, Orders, Accounts, and Jobs each use only the mixin. Separate advanced entries show filters, annotated subscriptions with lazy loading, and related filters with duplicate-producing searches. All data is synthetic. Larger presets are 10000, 100000, and 1000000; reset is explicit.

Compatibility

Python Django
3.12, 3.13, 3.14 5.2 LTS, 6.0, 6.1
3.15 6.1.3 onward

SQLite and PostgreSQL are supported. Stock Django admin is the supported theme. Compatibility details, query budgets and performance, optional configuration, and 0.4/0.5 → 0.5.1 migration.

Development

DJANGO_SETTINGS_MODULE=tests.settings python -m django test tests
npm ci
npm run build
npx playwright install chromium
npm run test:browser
python -m build
python scripts/verify_package.py

The Node lockfile is development-only. The build registers only the bar/line components used and keeps Chart.js out of the global namespace. Browser tests pin Chromium, fonts, locale, timezone, seed, and reference date.

Inspired by Dani Hodovic's original article.

Browser baselines share the gallery images and target Chromium on macOS. Firefox and WebKit behavior checks can be run with PLAYWRIGHT_BROWSER=firefox npm run test:browser or PLAYWRIGHT_BROWSER=webkit npm run test:browser after installing those browsers with Playwright.

Metadata

Release files for django-admin-list-charts 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-admin-list-charts 0.5.1
File Size Uploaded Provenance Actions
django_admin_list_charts-0.5.1.tar.gz 1.1 MB Without provenance Details for django_admin_list_charts-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-admin-list-charts 0.5.1
File Interpreter ABI Platform Actions
django_admin_list_charts-0.5.1-py3-none-any.whl Python 3 none any Details for django_admin_list_charts-0.5.1-py3-none-any.whl

Total release size: 1.2 MB

Release files / django_admin_list_charts-0.5.1.tar.gz

Download URL django_admin_list_charts-0.5.1.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
0bfa6c11f8e91b25b4cdb49651c2570871a433af19d605efcc92262d634b76a9
BLAKE2b-256 checksum
How to use checksums
7436a60aeca472977a4de3f01482616d41a7872d279a32286f65000b89c67501
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / django_admin_list_charts-0.5.1-py3-none-any.whl

Download URL django_admin_list_charts-0.5.1-py3-none-any.whl
Size 78.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec6e22b66bc69be8a04d20f5ddff562a16c0b76eaca1fa26c1dd7a64edb08d84
BLAKE2b-256 checksum
How to use checksums
17a8f121882b5535adaa7afd812460e01450556d840a5f14cddecc13dcb977c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Security for django-admin-list-charts 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page