Admin Configuration in Python

From the Django cheat sheet · Admin Interface · verified Jul 2026

Admin Configuration

Register and customize admin

python
from django.contrib import admin
from .models import Product

@admin.register(Product)
class ProductAdmin(admin.ModelAdmin):
    list_display = ['name', 'price', 'stock', 'created']
    list_filter = ['status', 'created']
    search_fields = ['name', 'description']
💡 Use list_editable for inline editing
📌 prepopulated_fields for slug generation
⚡ Custom actions for bulk operations
🟢 format_html for safe HTML in admin
Back to the full Django cheat sheet