Django Admin Tools
django-admin-tools is a collection of utilities for the Django administration interface, providing features like a customizable dashboard, menu system, and theming. The current version is 0.9.3. While it supports recent Django versions, its release cadence is slow, with the last release in 2021, suggesting a maintenance-focused development.
Common errors
-
NoReverseMatch at /admin/ 'admin:index' is not a registered namespace!
cause `admin_tools.urls` was included after `admin.site.urls` in your project's `urls.py`.fixChange the order in `urls.py` to include `admin_tools.urls` *before* `admin.site.urls`. -
Admin theme not applying or default Django theme showing.
cause `admin_tools.theming` is not the first app in `INSTALLED_APPS`.fixEnsure `'admin_tools.theming'` is the very first entry in your `INSTALLED_APPS` list in `settings.py`. -
ModuleNotFoundError: No module named 'admin_tools.dashboard'
cause One or more required `admin_tools` apps are missing from `INSTALLED_APPS`.fixAdd all necessary `admin_tools` apps (`'admin_tools'`, `'admin_tools.theming'`, `'admin_tools.menu'`, `'admin_tools.dashboard'`) to your `INSTALLED_APPS` list in `settings.py`.
Warnings
- gotcha The order of URL inclusion for `admin_tools.urls` and `admin.site.urls` is critical. `admin_tools.urls` must always be included *before* `admin.site.urls` in your main `urls.py`.
- gotcha For custom themes to apply correctly, `admin_tools.theming` must be the *very first* application listed in your `INSTALLED_APPS` setting.
- gotcha When customizing the dashboard or menu, you need to explicitly define `ADMIN_TOOLS_DASHBOARD` and `ADMIN_TOOLS_MENU` in your `settings.py` to point to your custom classes.
- gotcha While `django-admin-tools` 0.9.x supports Django 4.x and 5.x, the documentation and older examples often use `django.conf.urls.url`. For modern Django projects, use `django.urls.re_path` or `django.urls.path`.
Install
-
pip install django-admin-tools
Imports
- AdminToolsDashboard
from admin_tools.dashboard.models import Dashboard
- AdminToolsMenu
from admin_tools.menu.models import Menu
Quickstart
# settings.py
INSTALLED_APPS = [
'admin_tools.theming',
'admin_tools',
'admin_tools.menu',
'admin_tools.dashboard',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# ... your other apps
]
# urls.py
from django.contrib import admin
from django.urls import include, path, re_path
urlpatterns = [
re_path(r'^admin_tools/', include('admin_tools.urls')),
path('admin/', admin.site.urls),
# ... your other url patterns
]