Member-only story
Customizing Django Admin Like a Pro: Tips & Tricks
Django’s built-in admin panel is very powerful, by customizing Dajngo admin it can supercharge productivity and improve usability. Whether you’re building an internal tool or a full-fledged admin dashboard, these tips & tricks will help you level up your Django Admin skills.
1. Customize the Admin Dashboard Layout
By default, Django Admin lists models in alphabetical order. You can override this and customize the layout.
Create a custom admin index page:
# admin.py
from django.utils.translation import gettext_lazy as _
from django.contrib.admin import AdminSite
from .models import Product, User
# Create custom admin site by overriding AdminSite
class CustomAdminSite(AdminSite):
site_header = "My Custom Admin"
site_title = "Admin Panel"
index_title = "Welcome to My Dashboard"
admin_site = CustomAdminSite(name="custom_admin")
# Now you use admin_site to register your model
admin_site.register(User)
admin_site.register(Product)
2. Customize List Display with Admin Fields
The default Django Admin list view shows only the __str__
representation of a model. You can add more fields, sorting, and filtering.