Skip to main content

Model-aware business intelligence plugin for Django

Project description

django-fusion-analytics

Model-aware business intelligence plugin for Django. Visual query builder, joins via FK traversal, charts, and saved queries — all with a Tailwind-styled UI that ships as static assets (no build step at install time).

Install

uv add django-fusion-analytics

Add to INSTALLED_APPS and include URLs:

INSTALLED_APPS = ["fusion_analytics", ...]

# urls.py
urlpatterns = [
    path("analytics/", include("fusion_analytics.urls")),
    ...
]

Register models for BI access in any app's analytics.py:

from fusion_analytics.registry import site, ModelAnalytics
from .models import Order

@site.register
class OrderAnalytics(ModelAnalytics):
    model = Order
    # optional: explicit field whitelist
    # fields = ["id", "total", "customer__name"]
    # max_depth = 2  # FK traversal depth (default 2)
    # page_size = 100  # rows per page in the results table

    # optional: per-field rendering for the table view
    display_formats = {
        "total": {"type": "currency", "currency": "USD", "decimals": 2},
        "discount_rate": {"type": "percent", "decimals": 1, "scale": "fraction"},
        "ordered_at": {"type": "datetime", "format": "%b %d, %Y %H:%M"},
        "quantity": {"type": "number", "thousands": True, "decimals": 0},
    }

display_formats keys are full field paths (customer__name for traversed fields). Sort and CSV export always use the underlying raw value, so precision is preserved.

Settings

# settings.py — optional
FUSION_ANALYTICS_MAX_CSV_ROWS = 100_000  # cap on rows in a CSV export (default)

CSV export re-runs the active query on download (honoring filters, group-by, and aggregations) and caps the file at FUSION_ANALYTICS_MAX_CSV_ROWS rows. Set it to None to remove the cap.

Develop

uv sync                                 # install deps
uv run pytest                           # run tests
uv run black src/ tests/ testproject/   # format
uv run ruff check src/ tests/ testproject/  # lint

# Rebuild the bundled CSS after changing Tailwind classes in templates:
bash scripts/build_css.sh

The compiled CSS lives at src/fusion_analytics/static/fusion_analytics/css/fusion.css and is committed — end users do not run Tailwind.

Try it

uv run python testproject/manage.py makemigrations testapp
uv run python testproject/manage.py migrate
uv run python testproject/manage.py createsuperuser  # any creds
uv run python testproject/manage.py seed_demo
uv run python testproject/manage.py runserver

Then visit http://localhost:8000/analytics/ and log in.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_fusion_analytics-0.3.4.tar.gz (378.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_fusion_analytics-0.3.4-py3-none-any.whl (386.4 kB view details)

Uploaded Python 3

File details

Details for the file django_fusion_analytics-0.3.4.tar.gz.

File metadata

  • Download URL: django_fusion_analytics-0.3.4.tar.gz
  • Upload date:
  • Size: 378.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for django_fusion_analytics-0.3.4.tar.gz
Algorithm Hash digest
SHA256 864a98f37685aa5e42cf0208aaa97ca0be0df2084d7501cfc78dee98c70ea4b1
MD5 a1de5c082e8712017d037c23658a59bd
BLAKE2b-256 8f22c76eaba36327e36639bdc8b67b510274f68c0d6cbf4b6750941280b1cdd0

See more details on using hashes here.

File details

Details for the file django_fusion_analytics-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: django_fusion_analytics-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 386.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for django_fusion_analytics-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b1684176c9e14693e244bc62a7908af2e793475e20fc1c8c654a32b1abc6aa13
MD5 91b3c9cda0a0fc3e8e1ed74c2e83ba1f
BLAKE2b-256 fb0a5adfd51f863ed190d7dcea5444c5e4886404cbe6080e0438845be6b9c87e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page