websauna.system.admin.modeladmin module¶
Automatic admin and CRUD for SQLAlchemy models.
-
class
websauna.system.admin.modeladmin.
ModelAdmin
(request)[source]¶ Bases:
websauna.system.crud.sqlalchemy.CRUD
Resource presenting one model in admin interface.
Provide automatized list, show add, edit and delete actions for an SQLAlchemy model which declares admin interface.
-
get_model
()[source]¶ Get the SQLAlchemy model instance we are managing.
- Returns
SQLAlchemy model instance.
-
get_title
()[source]¶ Return human-readable title of this resource.
This is viewed in admin breadcrumbs path, etc.
- Return type
-
model
= None¶ Model must be set by subclass
-
title
= None¶ Title used in breadcrumbs, other places
-
-
class
websauna.system.admin.modeladmin.
ModelAdminRoot
(request)[source]¶ Bases:
websauna.system.core.traversal.Resource
Admin resource under which all model admins lurk.
To get access this resource:
-
get_model_admins
()[source]¶ List all registered model admin classes.
- Yield
(model_id, IModelAdmin) tuples
-
-
websauna.system.admin.modeladmin.
configure_model_admin
(config)[source]¶ Sets up model -> model admin registry.
-
websauna.system.admin.modeladmin.
model_admin
(traverse_id)[source]¶ Class decorator to mark the class to become part of model admins.
Configure.scan()
must be run on this module for the implementation to be picked up.If there is already an existing model admin with same
model
, then the existing model admin is overwritten.