One of Django's most celebrated features is its automatic Admin Back-Office. By inspecting your models, Django generates a complete, secure administrative portal with search, sorting, filtering, and bulk data manipulation.
# blog/admin.py
from django.contrib import admin
from .models import BlogPost, Comment
# 1. Inline: Edit comments directly inside the BlogPost admin page
class CommentInline(admin.TabularInline):
model = Comment
extra = 1
readonly_fields = ('created_at',)
# 2. Custom Bulk Action: Publish articles in bulk
@admin.action(description="Publish selected articles immediately")
def make_published(modeladmin, request, queryset):
updated = queryset.update(is_published=True)
modeladmin.message_user(request, f"Successfully published {updated} articles.")
# 3. ModelAdmin Customization
@admin.register(BlogPost)
class BlogPostAdmin(admin.ModelAdmin):
list_display = ('title', 'category', 'author', 'is_published', 'created_at', 'view_count')
list_filter = ('is_published', 'category', 'created_at')
search_fields = ('title', 'content', 'author__user__username')
prepopulated_fields = {'slug': ('title',)} # Auto-types slug as you type title!
date_hierarchy = 'created_at' # Top drill-down date navigation bar
ordering = ('-created_at',)
inlines = [CommentInline]
actions = [make_published]
fieldsets = (
('Article Content', {
'fields': ('title', 'slug', 'category', 'author', 'content', 'summary')
}),
('Publication Controls', {
'classes': ('collapse',), # Collapsible section!
'fields': ('is_published', 'reading_time_minutes', 'premium_price')
}),
)
Personalize the header, browser title, and welcome banner for your client or organization in urls.py:
# mywebsite/urls.py
from django.contrib import admin
admin.site.site_header = "Veewom Administration Portal"
admin.site.site_title = "Veewom Admin"
admin.site.index_title = "Welcome to Veewom Engineering Control Center"
For freelancers and software agencies, a tailored Django admin delivers immense value. Clients can immediately manage inventory, publish posts, export data, and moderate users from day one without paying for custom dashboard frontend development.
Broaden your backend architecture, REST API design, and production engineering expertise:
Register your application models with custom ModelAdmin classes.
Manage child records inline using TabularInline and StackedInline.
Control which admin modules are visible to staff vs superusers.
Inspect a highly customized Django admin panel with export actions.