API Reference
OpsDeck
Main entrypoint for integrating the admin into a FastAPI app.
Constructor
OpsDeck(
app,
secret_key,
*,
engine=None,
title="Admin",
prefix="/admin",
templates_dir=None,
add_csp_middleware=True,
max_recursion_depth=5,
auth_model=None,
audit_model=None,
demo_mode=False,
secure_cookies=None,
)
Key arguments
engine: async SQLAlchemy engine for database-backed admin featuresauth_model: admin user model used for login and permission checksaudit_model: concrete audit log model to persist change historysecure_cookies: override secure-cookie behavior directly; otherwise useADMIN_SECURE_COOKIES
Key methods
register(model, **options): quick registration pathadd_view(ModelAdminSubclass): advanced registration pathauto_discover(Base, include=None, exclude=None): register all supported declarative modelsget_session_dependency(): expose the admin session dependency for custom routes
ModelConfig
Stored configuration for a registered model.
Notable fields:
list_displaysearchable_fieldsfilter_fieldsorderingpermissionsrow_scopeactionsfield_overrideswidgetseager_loaddetail_panelsmenu_labelmenu_order
ModelAdmin
Declarative advanced configuration for a model. Useful when you need reusable admin behavior or more than a handful of register() options.
Example:
class UserAdmin(ModelAdmin):
model = User
list_display = ["id", "email", "is_active"]
permissions = {"view": ["*"], "edit": ["admin"]}
AdminAction
Defines a custom admin action.
Fields:
namelabelhandlerconfirmation_messagebulkvisible
DetailPanel
Adds custom detail content to edit/detail pages.
DashboardCard
Adds custom dashboard content from application-aware renderers.