Getting Started with Django Unfold: A Modern UI for Django Admin

Getting Started with Django Unfold: A Modern UI for Django Admin

3 min read

📌 Table of Contents

  1. What is Django Unfold?

  2. Why Choose Django Unfold Over Default Admin?

  3. Installing Django Unfold

  4. Basic Configuration

  5. Example: Customize a Product Model

  6. Advanced Customization

  7. Dark Mode and Theme Settings

  8. Use Cases & Best Practices

  9. Conclusion

đź’ˇ What is Django Unfold?

Django Unfold is a modern and customizable admin theme for Django, built on top of Tailwind CSS and inspired by tools like Laravel Nova and Django Jet.

It doesn’t just make your admin panel look better — it enhances the entire UX with navigation, action buttons, tabbed forms, dark mode, and more.

🚀 Why Choose Django Unfold Over Default Admin?

✨ UI/UX Design

  • Default Admin: Basic and feels outdated

  • Django Unfold: Clean, modern, and intuitive interface

📱 Mobile Responsiveness

  • Default Admin: Only partially responsive

  • Django Unfold: Fully responsive — works beautifully on all devices

🎨 Theme Customization

  • Default Admin: Requires manual changes in templates and CSS

  • Django Unfold: Easily customizable through settings

🌙 Dark Mode

  • Default Admin: ❌ Not available

  • Django Unfold: âś… Built-in dark mode support

đź’¨ Tailwind CSS Integration

  • Default Admin: ❌ No Tailwind support

  • Django Unfold: âś… Fully powered by Tailwind CSS

📚 Sidebar Navigation

  • Default Admin: Basic and non-expandable

  • Django Unfold: Expandable, searchable, and collapsible sidebar for smooth navigation

đź”§ Installing Django Unfold

Step 1: Install via pip

pip install django-unfold

Step 2: Add to INSTALLED_APPS

Ensure unfold is listed before django.contrib.admin in your settings.py:

INSTALLED_APPS = [
    "unfold",
    "django.contrib.admin",
    ...
]

⚙️ Basic Configuration

Here’s a minimal configuration to get started in settings.py:

UNFOLD = {
    "SITE_TITLE": "My Admin Dashboard",
    "SITE_HEADER": "My Admin Panel",
    "SHOW_HISTORY": True,
    "DARK_MODE": True,
    "SIDEBAR": {
        "show_search": True,
        "show_all_applications": True,
    }
}

Unfold settings support a lot more. You can even add custom menus, links, or branding.

đź§Ş Example: Customize a Product Model

Let’s create a simple Product model and see how Unfold improves the admin layout.

âś… models.py

from django.db import models

class Product(models.Model):
    name = models.CharField(max_length=200)
    price = models.DecimalField(max_digits=10, decimal_places=2)
    is_active = models.BooleanField(default=True)

    def __str__(self):
        return self.name

âś… admin.py

from unfold.admin import ModelAdmin
from django.contrib import admin
from .models import Product

@admin.register(Product)
class ProductAdmin(ModelAdmin):
    list_display = ("name", "price", "is_active")
    list_filter = ("is_active",)
    search_fields = ("name",)

âś… The only difference from the default admin is:
Use unfold.admin.ModelAdmin instead of admin.ModelAdmin.

🎨 Advanced Customization

Unfold allows you to customize:

✔️ Custom Actions:

actions = ['make_inactive']

def make_inactive(self, request, queryset):
    queryset.update(is_active=False)

✔️ Fieldsets and Tabs:

fieldsets = (
    ("Basic Info", {"fields": ("name", "price")}),
    ("Status", {"fields": ("is_active",)}),
)

In Unfold, fieldsets render with beautiful spacing and headings — and you can even create tabbed interfaces using custom templates.

🌙 Dark Mode and Theme Settings

Dark Mode is built-in. To enable:

UNFOLD = {
    ...
    "DARK_MODE": True,
}

You can even let users toggle dark/light themes from the admin interface.

đź§° Use Cases & Best Practices

Here are some real-world scenarios where Django Unfold shines:

  • SaaS Dashboards: Improve the backend view for internal team or clients.

  • Multi-tenant Admins: Help each organization feel personalized with theme support.

  • Data Entry Systems: Better layout for large forms and filters.

  • Internal ERP/CRM Admins: Make complex admin models more usable.

Tips:

  • Use unfold alongside django-import-export for advanced data control.

  • Use django-object-tools if you want to add buttons like "Mark as Published".

âś… Conclusion

Django Unfold is not just a visual upgrade — it’s a UX revolution for the Django admin. Without changing your models, you get:

âś… Tailwind-based design
âś… Sidebar nav, dark mode
âś… Easy customization
âś… Production-ready layout

Whether you’re building a client-facing dashboard or managing internal data, Unfold gives your Django admin the polish it deserves.