flask_admin.actions

action(name: str, text: str, confirmation: str | None = None) Callable[[...], Any][source]

Use this decorator to expose actions that span more than one entity (model, file, etc)

Parameters:
  • name – Action name

  • text – Action text.

  • confirmation – Confirmation text. If not provided, action will be executed unconditionally.

class ActionsMixin[source]

Actions mixin.

In some cases, you might work with more than one “entity” (model, file, etc) in your admin view and will want to perform actions on a group of entities simultaneously.

In this case, you can add this functionality by doing this: 1. Add this mixin to your administrative view class 2. Call init_actions in your class constructor 3. Expose actions view 4. Import actions.html library and add call library macros in your template

Default constructor.

get_actions_list() tuple[list[Any], dict[Any, Any]][source]

Return a list and a dictionary of allowed actions.

handle_action(return_view: str | None = None) Response | Response[source]

Handle action request.

Parameters:

return_view – Name of the view to return to after the request. If not provided, will return user to the return url in the form or the list view.

init_actions() None[source]

Initialize list of actions for the current administrative view.

is_action_allowed(name: str) bool[source]

Verify if action with name is allowed.

Parameters:

name – Action name