sqladmin
1
总安装量
1
周安装量
#42044
全站排名
安装命令
npx skills add https://github.com/jik92/sqladmin-skills --skill sqladmin
Skill 文档
SQLAdmin
Overview
Use this skill to implement SQLAdmin in FastAPI/Starlette apps, wire SQLAlchemy engines/sessions (sync or async), and tailor the admin UI via ModelView configuration, authentication, templates, and extensions.
Trigger examples
- âAdd an admin dashboard for my SQLAlchemy models in FastAPI.â
- âLock down the admin so only users with role=admin can access certain models.â
- âMake SQLAdmin work with an async engine and async sessionmaker.â
- âCustomize list columns and add a custom action button.â
- âOverride SQLAdmin templates for a custom layout.â
Quick start
- Create the SQLAlchemy engine (sync or async) and your models.
- Initialize
Admin(app, engine)(or pass asession_maker). - Define a
ModelViewfor each model andadd_viewit. - Visit
/admin(or your custom base URL).
See references/quickstart.md for a minimal setup pattern.
Core tasks
Configure ModelView behavior
- Lists, details, sorting, searching, filtering, pagination, and export options.
- Form scaffolding, overrides, and relationship field behaviors.
- Permissions and metadata (labels, icons, categories).
Use references/configurations.md for all ModelView options and examples.
Add authentication and access control
- Add
AuthenticationBackendto theAdmininstance. - Implement per-view visibility and access checks via
is_visible/is_accessible.
Use references/authentication.md for the required methods and patterns.
Role-based permissions
- Implement role checks in
is_accessibleandis_visible. - Apply per-model restrictions and per-action guards.
Use references/permissions.md for role and policy patterns.
Async SQLAlchemy integration
- Use
create_async_engineand asyncsessionmaker. - Ensure ModelView hooks handle async sessions correctly.
Use references/async.md for async engine/session patterns.
Customize templates and add custom views
- Override built-in templates or point views to custom templates.
- Add custom pages with
BaseViewand@expose.
Use references/templates-and-views.md for template and custom view patterns.
File and image fields
- Use
fastapi-storagesintegrations forFileType/ImageTypecolumns.
Use references/files.md for the storage-backed field setup.
Admin initialization options
- Customize base URL, title, logo, favicon, middlewares, and template directory.
Use references/admin-init.md for the Admin constructor options.
References
references/quickstart.mdreferences/configurations.mdreferences/authentication.mdreferences/permissions.mdreferences/async.mdreferences/templates-and-views.mdreferences/files.mdreferences/admin-init.md