Django Admin Interface
django-admin-interface is a Python package that provides a modern, responsive, and highly customizable administration interface for Django projects. It enhances the default Django admin with features like theme management, popup windows replaced by modals, sticky changelist actions, and improved styling. The current version is 0.32.0, and it maintains an active release cadence with regular updates for new Django and Python versions.
Common errors
-
ModuleNotFoundError: No module named 'admin_interface'
cause The 'admin_interface' app is not correctly added to `INSTALLED_APPS` in your `settings.py` or is misspelled.fixAdd 'admin_interface' and 'colorfield' to your `INSTALLED_APPS` list in `settings.py`, ensuring they are placed before 'django.contrib.admin'. -
My Django admin looks unstyled / has no CSS in production.
cause Static files for the admin interface have not been collected or your web server is not configured to serve them.fixRun `python manage.py collectstatic --clear --noinput` and ensure your web server configuration correctly serves static files from `STATIC_ROOT`. Clear your browser cache. -
Related object links open new browser popups instead of modals in the admin.
cause `X_FRAME_OPTIONS` is not set to 'SAMEORIGIN' in your Django settings, preventing the modal behavior.fixAdd `X_FRAME_OPTIONS = 'SAMEORIGIN'` to your `settings.py` file. -
Newly created apps/models are not showing up in the Django admin index after adding them.
cause The Django application containing the models has not been added to `INSTALLED_APPS` in `settings.py`, or `django.contrib.admin` itself is missing.fixEnsure your app (e.g., `'my_app'`) is listed in `INSTALLED_APPS` and that `django.contrib.admin` is also present. Make sure to restart your Django development server after changes.
Warnings
- breaking Version 0.29.0 dropped support for Python 3.8, Python 3.9, and Django 3.x. Projects on these older versions must upgrade their Python/Django environment or use an older version of django-admin-interface.
- gotcha For themes and styling to apply correctly, 'admin_interface' and 'colorfield' MUST be listed before 'django.contrib.admin' in your `settings.INSTALLED_APPS`. Incorrect order will result in default Django admin styling.
- gotcha If admin modals (e.g., for related objects) are not working and old popup windows are still appearing, you likely need to set `X_FRAME_OPTIONS` to 'SAMEORIGIN' in your `settings.py`.
- gotcha In production environments, the Django admin interface may appear unstyled (missing CSS) if static files are not collected and served correctly.
Install
-
pip install django-admin-interface
Imports
- admin_interface
INSTALLED_APPS = [ 'django.contrib.admin', 'admin_interface', 'colorfield', # ... other apps ]INSTALLED_APPS = [ 'admin_interface', 'colorfield', 'django.contrib.admin', # ... other apps ] - X_FRAME_OPTIONS
X_FRAME_OPTIONS = 'SAMEORIGIN'
Quickstart
import os
# Assuming you have a basic Django project setup
# settings.py
# Add to INSTALLED_APPS, ensuring order is correct:
INSTALLED_APPS = [
'admin_interface',
'colorfield',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# Your other apps
]
# Add X_FRAME_OPTIONS for modal functionality
X_FRAME_OPTIONS = 'SAMEORIGIN'
# Terminal commands (execute in your project's root directory):
# pip install django-admin-interface
# python manage.py migrate
# python manage.py collectstatic --clear --noinput
# python manage.py createsuperuser # if you don't have an admin user
# python manage.py runserver
# Then navigate to http://127.0.0.1:8000/admin/