Sidebar Navigation
The sidebar navigation in Django Unfold provides a customizable menu system for organizing and accessing your admin interface. Configure custom navigation groups, links, icons, badges, and permissions to create an intuitive admin experience.Basic Configuration
Define your sidebar navigation in theUNFOLD settings dictionary using the SIDEBAR key.
settings.py
Navigation Structure
Navigation is organized into groups, with each group containing multiple items.Navigation Groups
Display name for the navigation group
Show a top border separator for the group
Make the group expandable/collapsible
List of navigation items in the group
Badge text or callback function for the group
Navigation Items
Display name for the navigation item
Material Icon name from Google Fonts Icons
URL for the navigation item
Badge text or callback function
Badge color variant:
info, success, warning, primary, dangerBadge background style:
solid or outlinePermission check callback function
Custom active state callback function
Basic Examples
Simple Navigation
settings.py
Collapsible Groups
settings.py
Advanced Features
Dynamic Badges
Display dynamic badges with counts or notifications:settings.py
utils.py
Permission-Based Navigation
Show/hide navigation items based on user permissions:settings.py
utils.py
Dynamic Links
Generate navigation links dynamically:settings.py
utils.py
Nested Navigation
Create nested navigation items:settings.py
Search Configuration
Basic Sidebar Search
Enable simple search in application and model names:settings.py
Command Palette Search
Replace sidebar search with the more powerful command palette:settings.py
Show All Applications
Display a dropdown with all registered applications:settings.py
This option is useful when you have many applications but only show the most important ones in the custom navigation.
Complete Configuration Example
settings.py
Best Practices
Use Lazy Reverse for URLs
Use Lazy Reverse for URLs
Always use
reverse_lazy() instead of reverse() in settings to avoid circular import issues.Organize by User Journey
Organize by User Journey
Group navigation items based on user workflows and common tasks rather than by model hierarchy.
Use Meaningful Icons
Use Meaningful Icons
Choose icons that clearly represent the navigation item’s purpose. Browse Material Icons for options.
Cache Badge Counts
Cache Badge Counts
Cache expensive badge calculations to avoid performance issues.
Test Permissions
Test Permissions
Always test permission callbacks to ensure users only see appropriate navigation items.
Related Resources
Command Palette
Configure advanced search and navigation
Custom Pages
Add custom pages to your sidebar navigation
Tabs
Configure tab navigation for changeforms
Settings
View all available configuration options