Metadata-Version: 2.3
Name: django-fusion-analytics
Version: 0.2.0
Summary: Model-aware business intelligence plugin for Django
Author: BlakeFusionCollective
Author-email: BlakeFusionCollective <blake@fusioncollective.net>
Requires-Dist: django>=4.2
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# 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

```bash
uv add django-fusion-analytics
```

Add to `INSTALLED_APPS` and include URLs:

```python
INSTALLED_APPS = ["fusion_analytics", ...]

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

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

```python
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)
```

## Develop

```bash
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

```bash
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.
