Files
awesome-python/website/data/category_intros/admin-panels.md
T
Vinta ChenandClaude bc590c6272 docs: add Admin Panels category intro
Admin Panels had no intro, so its meta description fell back to generic text and readers got no guidance on which tool to pick.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-27 07:45:16 +08:00

3.7 KiB

Rather than hand-build a Python admin panel, use Flask-Admin in Flask apps. Django has one built in, which Unfold restyles for dashboards and Grappelli reskins.

How to choose:

  • A Flask app: Flask-Admin
  • Dashboards and a Tailwind CSS look on the Django admin: Unfold
  • A grid-based skin for the Django admin: Grappelli

Flask-Admin solves the boring problem of building an admin interface on top of an existing data model. Where the Django admin works from sensible defaults, Flask-Admin leaves it to you to tell it what to display and how. Register a ModelView for each model with admin.add_view() to get its list, create, and edit views. To shape them, subclass ModelView and set attributes like column_list and column_searchable_list. It works with several ORMs and MongoDB, and if you don't know where to start, its docs point you to SQLAlchemy. For a page that isn't tied to a model, like analytics, extend BaseView.

Unfold is a modern Django admin theme for building dashboards, internal tools, and business applications with Tailwind CSS. Put "unfold" first in INSTALLED_APPS, before django.contrib.admin. Your admin URLs stay the same. Your admin classes then inherit from unfold.admin.ModelAdmin, since the default class gives you unstyled forms without Unfold's features. That includes the User and Group admins Django registers for you, which you unregister and register again with Unfold's class. Build the dashboard by overriding the admin index template, fed with data from a callback.

Grappelli is a grid-based skin for the Django admin. Its FAQ says that if you're pleased with how the original admin looks, you probably shouldn't use it. Put grappelli before django.contrib.admin in INSTALLED_APPS, and include its URLs, which related lookups and autocompletes need. Its customization examples build on Django's own admin.ModelAdmin and inline classes. They add options for collapsible fieldsets, drag-and-drop inline sorting, and autocomplete lookups.

An admin panel is for trusted users. Django's docs limit the admin to an organization's internal management tool, not your whole front end. By default, it lets in only users with is_staff set. Unfold and Grappelli both run on it, so the same holds for them. When you need a process-centric interface instead of one built around tables and fields, write your own views. Flask-Admin leaves keeping unwanted users out to you: override is_accessible on your admin views with your own login check.

On Django, admin add-ons built for the stock look may not match a theme. Before you switch, check Unfold's integrations or Grappelli's third-party list for the ones you rely on.