API Docs

Invenio-Admin Flask extension.

class invenio_admin.ext.InvenioAdmin(app=None, **kwargs)[source]

Invenio-Admin extension.

Invenio-Admin extension initialization.

  • app – The Flask application. (Default: None)
  • kwargs – Passed to init_app().
init_app(app, entry_point_group='invenio_admin.views', permission_factory=None, view_class_factory=<function protected_adminview_factory>, index_view_class=<class 'flask_admin.base.AdminIndexView'>)[source]

Flask application initialization.

  • app – The Flask application.
  • entry_point_group – Name of entry point group to load views/models from. (Default: 'invenio_admin.views')
  • permission_factory – Default permission factory to use when protecting an admin view. (Default: admin_permission_factory())
  • view_class_factory – Factory for creating admin view classes on the fly. Used to protect admin views with authentication and authorization. (Default: protected_adminview_factory())
  • index_view_class – Specify administrative interface index page. (Default: flask_admin.base.AdminIndexView)
  • kwargs – Passed to flask_admin.base.Admin.

Extension state.

static init_config(app)[source]

Initialize configuration.

Parameters:app – The Flask application.


Admin view class factory for creating protected admin views on-the-fly.


Initialize menu before first request.


Factory for creating protected admin view classes.

The factory will ensure that the admin view will check if a user is authenticated and has the necessary permissions (as defined by the permission factory). The factory creates a new class using the provided class as base class and overwrites is_accessible() and inaccessible_callback() methods. Super is called for both methods, so the base class can implement further restrictions if needed.

Parameters:base_class (flask_admin.base.BaseView) – Class to use as base class.
Returns:Admin view class which provides authentication and authorization.


Flask-Admin form utilities.

class invenio_admin.forms.LazyChoices(func)[source]

Lazy form choices.

Initialize lazy choices.

Parameters:func – Function returning an iterable of choices.


Flask-Admin filter utilities.

class invenio_admin.filters.FilterConverter[source]

Filter converter for dealing with UUIDs and variants.

conv_uuid(column, name, **kwargs)[source]

Convert UUID filter.

conv_variant(column, name, **kwargs)[source]

Convert variants.

class invenio_admin.filters.UUIDEqualFilter(column, name, options=None, data_type=None)[source]

UUID aware filter.


  • column – Model field
  • name – Display name
  • options – Fixed set of options
  • data_type – Client data type
apply(query, value, alias)[source]

Convert UUID.

  • query – SQLAlchemy query object.
  • value – UUID value.
  • alias – Alias of the column.

Filtered query matching the UUID value.


Permissions for Invenio-Admin.

invenio_admin.permissions.action_admin_access = Need(method='action', value='admin-access')

Define the action needed by the default permission factory.


Default factory for creating a permission for an admin.

It tries to load a invenio_access.permissions.Permission instance if invenio_access is installed. Otherwise, it loads a flask_principal.Permission instance.

Parameters:admin_view – Instance of administration view which is currently being protected.
Returns:Permission instance.