anvil_consortium_manager.adapters.workspace module

Contains default adapter for workspaces.

exception anvil_consortium_manager.adapters.workspace.AdapterAlreadyRegisteredError

Bases: Exception

Exception raised when an adapter or its type is already registered.

exception anvil_consortium_manager.adapters.workspace.AdapterNotRegisteredError

Bases: Exception

Exception raised when an adapter is not registered.

class anvil_consortium_manager.adapters.workspace.BaseWorkspaceAdapter

Bases: abc.ABC

Base class to inherit when customizing the workspace adapter.

abstract property description

String with a description of the workspace/

This will be displayed on the workspace landing page.

get_description()

Return the workspace description specified in the adapter.

get_list_table_class()

Return the table class to use for the WorkspaceListByType view.

get_name()

Return the name specified in the adapter.

get_type()

Return the workspace data type specified in the adapter.

get_workspace_data_form_class()

Return the form used to create workspace_data_model.

This could be expanded to build a form from the workspace_data_model specified.

get_workspace_data_model()

Return the workspace_data_model.

get_workspace_detail_template_name()

Return the workspace detail template name specified in the adapter.

abstract property list_table_class

Table class to use in a list of workspaces.

abstract property name

String specifying the namee of this type of workspace.

abstract property type

String specifying the workspace type.

This will be added to the anvil_consortium_manager.models.Workspace workspace_type field.

abstract property workspace_data_form_class

Form for the model specified in workspace_data_model.

abstract property workspace_data_model

Model to use for storing extra data about workspaces.

abstract property workspace_detail_template_name

path to workspace detail template

class anvil_consortium_manager.adapters.workspace.WorkspaceAdapterRegistry

Bases: object

Registry to store workspace adapters for different model types.

get_adapter(type)

“Return an instance of the adapter for a given workspace type.

get_registered_adapters()

Return the registered adapters.

get_registered_names()

Return a dictionary of registered adapter names.

populate_from_settings()

Populate the workspace adapter registry from settings. Called by AppConfig ready() method.

register(adapter_class)

Register an adapter class using its type.

unregister(adapter_class)

Unregister an adapter class.

anvil_consortium_manager.adapters.workspace.workspace_adapter_registry = <anvil_consortium_manager.adapters.workspace.WorkspaceAdapterRegistry object>

Global variable to store all registered workspace adapters.

Adapters specified in the ANVIL_WORKSPACE_ADAPTERS setting will be registered in the app config’s .ready() method.