Django Slick Reporting#

The one-stop reporting engine for Django — analytics, charts & dashboards in a few lines of code.

PyPI version Python versions Docs Coverage License

Django Slick Reporting dashboard

Grouped totals, time-series, crosstabs and pivots — each one a small Python class, each one chartable with a single line, in Highcharts, Chart.js or ApexCharts.


Why Django Slick Reporting?#

Every report shape

Simple aggregates, group-by, time-series, crosstab/pivot, and any combination of them, in a handful of lines.

Charts included

Highcharts, Chart.js and ApexCharts wrappers — bar, column, line, area, pie, stacked or totalled.

Custom calculations

Build reusable computation fields, chain dependencies, compute percentages and balances.

Dashboards

Drop any report onto a page as a self-contained widget with a single template tag.

Model-optional

Report against a Django model, a traversed relation, a raw SQL table, or precomputed/aggregated data.

Fast & extendable

Optimized queries, CSV export out of the box, and hooks for everything.

Installation#

To install django-slick-reporting with pip

pip install django-slick-reporting

Usage#

  1. Add "slick_reporting", "crispy_forms", "crispy_bootstrap4", to INSTALLED_APPS.

  2. Add CRISPY_TEMPLATE_PACK = "bootstrap4" to your settings.py

  3. Execute python manage.py collectstatic so the JS helpers are collected and served.

Quickstart#

You can start by using ReportView which is a subclass of django.views.generic.FormView

# in views.py
from slick_reporting.views import ReportView, Chart
from slick_reporting.fields import ComputationField
from .models import MySalesItems
from django.db.models import Sum


class ProductSales(ReportView):

    report_model = MySalesItems
    date_field = "date_placed"
    group_by = "product"

    columns = [
        "title",
        ComputationField.create(
            method=Sum, field="value", name="value__sum", verbose_name="Total sold $"
        ),
    ]

    # Charts
    chart_settings = [
        Chart(
            "Total sold $",
            Chart.BAR,
            data_source=["value__sum"],
            title_source=["title"],
        ),
    ]


# in urls.py
from django.urls import path
from .views import ProductSales

urlpatterns = [
    path("product-sales/", ProductSales.as_view(), name="product-sales"),
]

That’s the whole report — filter form, chart, sortable data table and CSV export are generated for you.

Demo site#

django-slick-reporting.com is a quick walk-though with live code examples.

Where to next?#

What Django Slick Reporting is and how its pieces fit together.

Build group-by, time-series and crosstab reports step by step.

Deep dives — options, forms, charts, exporting, widgets.

API reference for views, fields, generator and settings.

Indices and tables#