Bases: horizon.tables.actions.BaseAction
Represents an action which can be taken on this table’s data.
Required. The short name or “slug” representing this action. This name should not be changed at runtime.
A descriptive name used for display purposes. Defaults to the value of name with the first letter of each word capitalized.
Used like verbose_name in cases where handles_multiple is True. Defaults to verbose_name with the letter “s” appended.
The HTTP method for this action. Defaults to POST. Other methods may or may not succeed currently.
Boolean value indicating whether or not this action can be taken without any additional input (e.g. an object id). Defaults to True.
Boolean value indicating whether this action should be evaluated in the period after the table is instantiated but before the data has been loaded.
This can allow actions which don’t need access to the full table data to bypass any API calls and processing which would otherwise be required to load the table.
A list that contains the allowed data types of the action. If the datum’s type is in this list, the action will be shown on the row for the datum.
Default to be an empty list ([]). When set to empty, the action will accept any kind of data.
At least one of the following methods must be defined:
Handler for a single-object action.
Handler for multi-object actions.
If a single function can work for both single-object and multi-object cases then simply providing a handle function will internally route both single and multiple requests to handle with the calls from single being transformed into a list containing only the single object id.
Returns the full POST parameter name for this action.
Defaults to {{ table.name }}__{{ action.name }}.
Bases: horizon.utils.html.HTMLElement
Common base class for all Action classes.
Determine whether this action is allowed for the current request.
This method is meant to be overridden with more specific checks.
Method to see if the action is allowed for a certain type of data. Only affects mixed data type tables.
Returns a list of the default HTML attributes for the action. Defaults to returning an id attribute with the value {{ table.name }}__action_{{ action.name }}__{{ creation counter }}.
Returns a list of the default classes for the action. Defaults to ["btn", "btn-small"].
Allows per-action customization based on current conditions.
This is particularly useful when you wish to create a “toggle” action that will be rendered differently based on the value of an attribute on the current row’s data.
By default this method is a no-op.
Bases: horizon.tables.actions.Action
An internal name for this action.
String or tuple/list. The display forms of the name. Should be a transitive verb, capitalized and translated. (“Delete”, “Rotate”, etc.) If tuple or list - then setting self.current_present_action = n will set the current active item from the list(action_present[n])
String or tuple/list. The past tense of action_present. (“Deleted”, “Rotated”, etc.) If tuple or list - then setting self.current_past_action = n will set the current active item from the list(action_past[n])
A display name for the type of data that receives the action. (“Keypair”, “Floating IP”, etc.)
Optional plural word for the type of data being acted on. Defaults to appending ‘s’. Relying on the default is bad for translations and should not be done.
Optional location to redirect after completion of the delete action. Defaults to the current page.
Required. Accepts a single object id and performs the specific action.
Return values are discarded, errors raised are caught and logged.
Returns the URL to redirect to after a successful action.
Switches the action verbose name, if needed
Bases: horizon.tables.actions.BatchAction
Bases: horizon.tables.actions.BaseAction
A base class representing a filter action for a table.
The short name or “slug” representing this action. Defaults to "filter".
A descriptive name used for display purposes. Defaults to the value of name with the first letter of each word capitalized.
A string representing the name of the request parameter used for the search term. Default: "q".
Provides the actual filtering logic.
This method must be overridden by subclasses and return the filtered data.
Returns the full query parameter name for this action.
Defaults to {{ table.name }}__{{ action.name }}__{{ action.param_name }}.
Bases: horizon.tables.actions.FilterAction
A filter action with fixed buttons.
Override to separate images into categories.
Return a dict with a key for the value of each fixed button, and a value that is a list of images in that category.
Returns a list of dictionaries describing the fixed buttons to use for filtering.
text: Text to display on the button icon: Icon class for icon element (inserted before text). value: Value returned when the button is clicked.
This value is passed to filter() as filter_string.
Bases: horizon.tables.actions.BaseAction
A table action which is simply a link rather than a form POST.
Required. The short name or “slug” representing this action. This name should not be changed at runtime.
A string which will be rendered as the link text. (Required)
A string or a callable which resolves to a url to be used as the link target. You must either define the url attribute or override the get_link_url method on the class.
A list that contains the allowed data types of the action. If the datum’s type is in this list, the action will be shown on the row for the datum.
Defaults to be an empty list ([]). When set to empty, the action will accept any kind of data.
Returns the final URL based on the value of url.
If url is callable it will call the function. If not, it will then try to call reverse on url. Failing that, it will simply return the value of url as-is.
When called for a row action, the current row data object will be passed as the first parameter.