Layout

Every page extends the package's base template, adminlte/page.html — the Django equivalent of the other ports' DashboardLayout. You override the blocks you need; the navbar, sidebar, messages and footer are rendered for you.

Extending the layout

adminlte/page.html extends adminlte/master.html and adds the content header (page title + breadcrumb). Provide three blocks — page_title, breadcrumb and content:

{% extends "adminlte/page.html" %}

{% block page_title %}Dashboard{% endblock %}

{% block breadcrumb %}
    <li class="breadcrumb-item active">Dashboard</li>
{% endblock %}

{% block content %}
    <div class="row">
        <div class="col-lg-3 col-6">
            {% component "adminlte_small_box" title="150" text="New Orders" theme="primary" icon="bi bi-bag" url="#" %}{% endcomponent %}
        </div>
    </div>

    {% component "adminlte_card" title="Welcome" icon="bi bi-stars" theme="primary" outline=True collapsible=True %}
        Built with AdminLTE 4 components.
    {% endcomponent %}
{% endblock %}

Render it from a view exactly like any Django template:

from django.shortcuts import render

def dashboard(request):
    return render(request, "dashboard.html")

Available blocks

BlockWhat it controls
titleThe <title> tag (defaults to the adminlte_title tag).
metaExtra <meta> tags in <head>.
adminlte_assetsThe base CSS/JS (Vite or the pre-built bundle). Override to swap the pipeline.
extra_cssPage CSS, after the base styles.
content_headerThe page header row (wraps page_title + breadcrumb).
page_titleThe <h3> page heading.
breadcrumbThe breadcrumb area (defaults to the auto trail — see below).
messagesDjango messages, rendered as AdminLTE alerts. Override to customise.
contentYour main page content.
extra_jsJS before </body> — add page-specific scripts and plugins here.

The shell

adminlte/master.html assembles the dashboard chrome from partials: navbar.html, sidebar.html, the content header, the messages block and footer.html. The <body> class string is computed by the adminlte_body_classes tag from your layout config (layout-fixed, fixed-header, sidebar-mini, sidebar-expand-lg, etc.), and the navbar/sidebar render the config-driven menu via the filter pipeline.

The three menus are wrapped in SimpleLazyObject, so templates that never render a sidebar (auth pages, error pages, e-mails) never pay for a menu build at all.

Breadcrumbs

The default content of the breadcrumb block is {% adminlte_breadcrumb %}, which derives a Home → … trail from request.path automatically (title-casing each segment). Override the block to hand-author your crumbs:

{% block breadcrumb %}
    <li class="breadcrumb-item"><a href="/">Home</a></li>
    <li class="breadcrumb-item active">Projects</li>
{% endblock %}

Adding page assets

Use extra_css / extra_js to append page-specific files without losing the base assets:

{% block extra_js %}
    <script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
    <script>/* init charts here */</script>
{% endblock %}

Django's messages framework is rendered as dismissible AdminLTE alerts automatically — levels map to Bootstrap contextual classes plus an icon, and error becomes danger, so no MESSAGE_TAGS config is needed.


AdminLTE 4 · Django port Edit on GitHub