Build a custom Django admin dashboard with Unfold

Learn how to build a custom Django admin dashboard with Unfold using custom data, reusable components, charts, tables, and KPI cards.

  • calendar_month 16.12.2023 Updated: 04.09.2026
  • pace 12 minutes

Django includes a powerful administration interface, but its default dashboard is intentionally simple. It primarily displays registered applications and models together with recent admin actions.

For many internal tools and business applications, the dashboard can be much more useful. With Django Unfold, you can turn the admin index into a custom Django admin dashboard with statistics, KPI cards, charts, tables, progress indicators, and data from your Django models.

In this guide, we will build a custom Django admin dashboard using Unfold's dashboard callback and reusable component library.

What is a Django admin dashboard?

The default Django admin index provides quick access to models registered in the administration site. This works well for smaller projects, but larger applications often need an overview of important business data immediately after signing in.

A custom Django admin dashboard can display information such as:

  • Key performance indicators
  • Orders and revenue
  • New users or customers
  • Recent activity
  • Charts and trends
  • Tables with important records
  • Progress and status information
  • Links to frequently used admin pages

Django allows the admin index template to be overridden manually. Unfold builds on top of this mechanism and provides additional tools for passing data into the dashboard and rendering it using components that match the rest of the admin interface.

Install Django Unfold

Install django-unfold using your preferred Python package manager.

uv add django-unfold

Alternatively, you can use pip or Poetry:

pip install django-unfold
poetry add django-unfold

Add unfold before django.contrib.admin in INSTALLED_APPS:

# settings.py

INSTALLED_APPS = [
    "unfold",
    "django.contrib.admin",
    # Other applications
]

Admin classes should inherit from Unfold's ModelAdmin:

# admin.py

from django.contrib import admin
from unfold.admin import ModelAdmin

from .models import Product


@admin.register(Product)
class ProductAdmin(ModelAdmin):
    pass

For the complete installation and configuration options, see the Unfold installation documentation.

Create a custom Django admin dashboard

Django uses admin/index.html for the main admin dashboard. Create the following file in your project:

templates/admin/index.html

Make sure your project-level templates directory is configured in settings.py:

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [BASE_DIR / "templates"],
        # ...
    },
]

Your dashboard template can start with the regular Unfold admin layout:

{% extends "admin/base.html" %}

{% load i18n unfold %}

{% block title %}
    {% if subtitle %}
        {{ subtitle }} |
    {% endif %}

    {{ title }} | {{ site_title|default:_("Django site admin") }}
{% endblock %}

{% block branding %}
    {% include "unfold/helpers/site_branding.html" %}
{% endblock %}

{% block content %}
    <!-- Dashboard content -->
{% endblock %}

At this point, you have full control over the content displayed on the Django admin index.

Pass data to the dashboard

A useful dashboard normally needs information from your database.

Without Unfold, this often means extending AdminSite and overriding its index() method. Unfold provides a simpler DASHBOARD_CALLBACK setting specifically for injecting additional variables into admin/index.html.

Configure the callback in your settings:

# settings.py

UNFOLD = {
    "DASHBOARD_CALLBACK": "app.views.dashboard_callback",
}

Then create the callback:

# app/views.py

from app.models import Order, Product


def dashboard_callback(request, context):
    context.update(
        {
            "orders_count": Order.objects.count(),
            "products_count": Product.objects.count(),
            "recent_orders": Order.objects.order_by("-created_at")[:5],
        }
    )

    return context

The values added to context are now available directly inside templates/admin/index.html.

This makes it straightforward to calculate business metrics with the Django ORM and display them on the dashboard.

For more details, see the Django admin dashboard documentation.

Build KPI cards with Unfold components

Unfold includes reusable components designed to match the rest of the admin interface.

Instead of creating every dashboard widget from scratch, you can compose cards, titles, text, tables, charts, progress indicators, and other components directly in Django templates.

For example, the values passed through DASHBOARD_CALLBACK can be displayed as KPI cards:

{% block content %}
    {% component "unfold/components/flex.html" with class="gap-8" %}
        {% component "unfold/components/card.html" %}
            {% component "unfold/components/text.html" %}
                {% trans "Orders" %}
            {% endcomponent %}

            {% component "unfold/components/title.html" %}
                {{ orders_count }}
            {% endcomponent %}
        {% endcomponent %}

        {% component "unfold/components/card.html" %}
            {% component "unfold/components/text.html" %}
                {% trans "Products" %}
            {% endcomponent %}

            {% component "unfold/components/title.html" %}
                {{ products_count }}
            {% endcomponent %}
        {% endcomponent %}
    {% endcomponent %}
{% endblock %}

Components can be nested, which makes it possible to create complex dashboard layouts without splitting every visual element into a separate template.

The full component library is available in the Unfold components documentation.

Add charts to Django admin

Charts are useful for displaying revenue, registrations, orders, traffic, or other values that change over time.

Unfold includes chart components for building line and bar charts directly inside the admin interface. Chart rendering is powered by Chart.js and styled to match the Unfold design system.

A dashboard can therefore combine:

  • KPI cards for important totals
  • Line charts for trends over time
  • Bar charts for comparisons
  • Tables for individual records
  • Progress bars for targets or completion
  • Cohort visualizations for retention data

The Python side of the dashboard can prepare the dataset while the component handles its presentation.

See the Unfold chart component documentation for configuration examples.

Add tables and recent records

Not every dashboard value needs to be visualized as a chart.

For example, an ecommerce dashboard might display the five latest orders together with their customer, status, and total value.

Prepare the queryset inside the dashboard callback:

def dashboard_callback(request, context):
    context.update(
        {
            "recent_orders": Order.objects.select_related("customer")
            .order_by("-created_at")[:5],
        }
    )

    return context

You can then display this information with Unfold's table components or build a custom presentation directly in the dashboard template.

Keeping database queries in Python and presentation logic in templates makes larger dashboards easier to maintain.

Django admin dashboard example

A real dashboard will usually combine several types of information instead of displaying a single chart or KPI.

For example, an ecommerce dashboard can include:

  • Revenue and order KPIs
  • Sales trends
  • Order status distribution
  • Recent orders
  • Top products
  • Customer statistics
  • Date or period filters

You can see these concepts combined in the Unfold live demo, which demonstrates how Django admin can be turned into a more complete internal tool with dashboards, charts, tables, filters, and custom layouts.

The demo is a useful reference when designing your own Django admin dashboard and deciding which information should be visible immediately after signing in.

Pre-built Django dashboard templates

If you don't want to build the entire dashboard structure from scratch, Unfold Studio includes pre-built dashboard examples with complete backend and frontend implementations.

The examples demonstrate how to prepare dashboard data in Django, structure reusable components, create responsive layouts, and integrate charts and other visualizations.

They can be used as a starting point and adapted to the models and business logic in your own Django project.

Django admin dashboard FAQ

Can Django admin be used as a dashboard?

Yes. Django's admin index template can be overridden and used to display custom application data. Unfold makes this easier by providing a dashboard callback and reusable components designed specifically for Django admin interfaces.

How do I customize the Django admin dashboard?

Create a templates/admin/index.html template to replace the default admin index. With Unfold, you can use DASHBOARD_CALLBACK to pass additional data from Python into this template and render it using Unfold components.

Can I add charts to Django admin?

Yes. Unfold provides built-in chart components for line and bar charts. You can prepare data using Django and display it inside your admin dashboard using the component system.

Can a Django admin dashboard display custom database data?

Yes. Any information you can retrieve or calculate in Python can be passed into the dashboard context. This includes querysets, aggregated statistics, calculated metrics, recent records, or data from external services.

Build more than a default Django admin

The Django admin is a strong foundation for internal applications, but the default index does not have to remain a simple list of models.

With Unfold, you can use the existing Django admin architecture while adding custom dashboards, reusable components, charts, tables, filters, and your own business data.

Start with a few important metrics, keep the dashboard focused on information users actually need, and expand it as your internal application grows.

© 2023 - 2026 Created by unfoldadmin.com. All rights reserved.