docs: rewrite Admin Panels category intro

The intro predated the 2026-10-02 audit and did not mention the newly added sqladmin.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Vinta Chen
2026-10-02 16:17:17 +08:00
co-authored by Claude
parent 49eac935e0
commit d08d043195
+9 -8
View File
@@ -1,17 +1,18 @@
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.
Django saves you from building a Python admin panel: its admin comes built in. Flask-Admin and SQLAdmin add one to Flask and FastAPI apps.
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
- SQLAlchemy models in FastAPI or Starlette: SQLAdmin
- A Django admin grown into dashboards and internal tools: Unfold
- A new look for the Django admin, on your stock ModelAdmin classes: Grappelli
Flask-Admin [solves the boring problem](https://flask-admin.readthedocs.io/en/stable/) 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](https://flask-admin.readthedocs.io/en/stable/advanced/#migrating-from-django) to tell it what to display and how. Register [a `ModelView` for each model](https://flask-admin.readthedocs.io/en/stable/introduction/#adding-model-views) 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](https://flask-admin.readthedocs.io/en/stable/advanced/#using-different-database-backends). For a page that isn't tied to a model, like analytics, extend [`BaseView`](https://flask-admin.readthedocs.io/en/stable/introduction/#standalone-views).
Flask-Admin [gives each model a `ModelView`](https://flask-admin.readthedocs.io/en/latest/introduction/#adding-model-views): one `admin.add_view(ModelView(User, db.session))` line gets you list, create, and edit pages for it. To fit a model, [subclass `ModelView`](https://flask-admin.readthedocs.io/en/latest/introduction/#customizing-built-in-views) and set class attributes like `can_delete` or `column_list`. Expect fewer defaults than in Django's admin: [it's up to you to tell Flask-Admin](https://flask-admin.readthedocs.io/en/latest/advanced/#design-philosophy) what to display and how. Besides SQLAlchemy, it has [backends](https://flask-admin.readthedocs.io/en/latest/advanced/#using-different-database-backends) for Peewee, pymongo, and MongoEngine.
Unfold is [a modern Django admin theme](https://unfoldadmin.com/) for building dashboards, internal tools, and business applications with Tailwind CSS. Put `"unfold"` [first in `INSTALLED_APPS`](https://unfoldadmin.com/docs/installation/quickstart/), 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](https://unfoldadmin.com/docs/installation/auth/) with Unfold's class. Build [the dashboard](https://unfoldadmin.com/docs/configuration/dashboard/) by overriding the admin index template, fed with data from a callback.
SQLAdmin brings Flask-Admin's approach to SQLAlchemy models on FastAPI or Starlette: Flask-Admin [inspired most of its features and configuration](https://smithyhq.github.io/sqladmin/#related-projects-and-inspirations). Create an `Admin` from your app and engine, then [write one `ModelView` subclass per model](https://smithyhq.github.io/sqladmin/#quickstart), declared with `model=User`, and register it with `admin.add_view`.
Grappelli is [a grid-based skin](https://django-grappelli.readthedocs.io/en/latest/) for the Django admin. Its FAQ says that [if you're pleased with how the original admin looks](https://django-grappelli.readthedocs.io/en/latest/faq.html#why-should-i-use-grappelli), you probably shouldn't use it. Put `grappelli` before `django.contrib.admin` in `INSTALLED_APPS`, and [include its URLs](https://django-grappelli.readthedocs.io/en/latest/quickstart.html#setup), which related lookups and autocompletes need. Its [customization examples](https://django-grappelli.readthedocs.io/en/latest/customization.html) build on Django's own `admin.ModelAdmin` and inline classes. They add options for collapsible fieldsets, drag-and-drop inline sorting, and autocomplete lookups.
Unfold is a theme for Django's own admin, [made for building dashboards, internal tools, and business applications](https://github.com/unfoldadmin/django-unfold). Put `"unfold"` [before `django.contrib.admin`](https://unfoldadmin.com/docs/installation/quickstart/) in `INSTALLED_APPS`, then make your admin classes inherit from `unfold.admin.ModelAdmin`: the stock `ModelAdmin` leaves forms unstyled.
An admin panel is for trusted users. Django's docs [limit the admin](https://docs.djangoproject.com/en/stable/ref/contrib/admin/#overview) 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](https://flask-admin.readthedocs.io/en/stable/introduction/#authorization-permissions) to you: override `is_accessible` on your admin views with your own login check.
Grappelli is [a jazzy skin for the Django admin](https://django-grappelli.readthedocs.io/en/latest/) that also adds collapsibles, sortable inlines, and related and autocomplete lookups. Put `'grappelli'` [before `django.contrib.admin`](https://django-grappelli.readthedocs.io/en/latest/quickstart.html) in `INSTALLED_APPS`, and include `grappelli.urls`, which the lookups need. You switch features on with [attributes on your `admin.ModelAdmin` classes](https://django-grappelli.readthedocs.io/en/latest/customization.html#autocomplete-lookups), like `autocomplete_lookup_fields`.
On Django, admin add-ons built for the stock look may not match a theme. Before you switch, check [Unfold's integrations](https://unfoldadmin.com/docs/) or [Grappelli's third-party list](https://django-grappelli.readthedocs.io/en/latest/thirdparty.html) for the ones you rely on.
By default, Django's admin [lets in only users with `is_staff` set](https://docs.djangoproject.com/en/stable/ref/contrib/admin/#overview). Flask-Admin and SQLAdmin leave access control to you: in Flask-Admin, [override `is_accessible`](https://flask-admin.readthedocs.io/en/latest/introduction/#rolling-your-own) on your views, and SQLAdmin [enforces no authentication](https://smithyhq.github.io/sqladmin/authentication/) until you pass it an `AuthenticationBackend`. Django's docs limit its admin to [an internal management tool](https://docs.djangoproject.com/en/stable/ref/contrib/admin/), and once you need a process-centric interface, they say to write your own views.