anvil_consortium_manager.adapters.workspace module
Contains default adapter for workspaces.
- exception anvil_consortium_manager.adapters.workspace.AdapterAlreadyRegisteredError
Bases:
ExceptionException raised when an adapter or its type is already registered.
- exception anvil_consortium_manager.adapters.workspace.AdapterNotRegisteredError
Bases:
ExceptionException raised when an adapter is not registered.
- class anvil_consortium_manager.adapters.workspace.BaseWorkspaceAdapter
Bases:
ABCBase class to inherit when customizing the workspace adapter.
- after_anvil_create(workspace)
Custom actions to take after a workspace is created on AnVIL.
- after_anvil_import(workspace)
Custom actions to take after a workspace is imported from AnVIL.
- before_anvil_create(workspace)
Custom actions to take after a workspace is created on AnVIL.
- abstract property description
String with a description of the workspace/
This will be displayed on the workspace landing page.
- get_autocomplete_queryset(queryset, q, forwarded=None)
Return the queryset after filtering for WorkspaceAutocompleteByType view.
The default filtering is that the workspace name contains the queryset, case- insensitive. If desired, custom autocomplete filtering for a workspace type can be implemented by overriding this method.
- get_description()
Return the workspace description specified in the adapter.
- get_extra_detail_context_data(workspace, request)
Return the extra context specified in the adapter.
- Parameters:
workspace (anvil_consortium_manager.models.Workspace) – The workspace for which to get the extra context.
request (django.http.HttpRequest) – The request for the view.
- Returns:
Extra context to add to or update the workspace detail view.
- Return type:
dict
- get_list_table_class_staff_view()
Return the table class to use for the WorkspaceListByType view for staff.
- get_list_table_class_view()
Return the table class to use for the WorkspaceListByType view for non-staff users.
- 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.
- get_workspace_form_class()
Return the form used to create a Workspace.
- abstract property list_table_class_staff_view
Table class to use in a list of workspaces for users with staff view permission.
- 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.Workspaceworkspace_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
- abstract property workspace_form_class
Custom form to use when creating a Workspace.
- workspace_list_template_name = 'anvil_consortium_manager/workspace_list.html'
path to workspace list template
- class anvil_consortium_manager.adapters.workspace.WorkspaceAdapterRegistry
Bases:
objectRegistry 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_ADAPTERSsetting will be registered in the app config’s.ready()method.