list_action¶
- class camelot.admin.action.list_action.AddExistingObject[source]¶
Add an existing object to a list if it is not yet in the list
- class camelot.admin.action.list_action.AddNewObject[source]¶
Add a new object to a collection. Depending on the ‘create_inline’ field attribute, a new form is opened or not.
This action will also set the default values of the new object, add the object to the session, and flush the object if it is valid.
- class camelot.admin.action.list_action.CallMethod(verbose_name, method, enabled=None)[source]¶
Call a method on all objects in a selection, and flush the session.
Parameters: - verbose_name – the name of the action, as it should appear to the user
- method – the method to call on the objects
- enabled – method to call on objects to verify if the action is enabled, by default the action is always enabled
This action can be used either within list_actions or within form_actions.
- class camelot.admin.action.list_action.ChangeAdmin(admin)[source]¶
Change the admin of a tableview, this action is used to switch from one subclass to another in a table view.
- class camelot.admin.action.list_action.DuplicateSelection[source]¶
Duplicate the selected rows in a table
- class camelot.admin.action.list_action.EditAction[source]¶
A base class for an action that will modify the model, it will be disabled when the field_attributes for the relation field are set to not-editable.
- class camelot.admin.action.list_action.ExportSpreadsheet[source]¶
Export all rows in a table to a spreadsheet
- class camelot.admin.action.list_action.ImportFromFile[source]¶
Import a csv file in the current table
- class camelot.admin.action.list_action.ListActionGuiContext[source]¶
The context for an Action on a table view. On top of the attributes of the camelot.admin.action.application_action.ApplicationActionGuiContext, this context contains :
- item_view¶
the QtWidgets.QAbstractItemView class that relates to the table view on which the widget will be placed.
- view¶
a camelot.view.controls.view.AbstractView class that represents the view in which the action is triggered.
- field_attributes¶
a dictionary with the field attributes of the list. This dictionary will be filled in case if the list displayed is related to a field on another object. For example, the list of addresses of Person will have the field attributes of the Person.addresses field when displayed on the Person form.
- model_context¶
alias of ListActionModelContext
- class camelot.admin.action.list_action.ListActionModelContext[source]¶
On top of the attributes of the camelot.admin.action.application_action.ApplicationActionModelContext, this context contains :
- selection_count¶
the number of selected rows.
- collection_count¶
the number of rows in the list.
- selected_rows¶
an ordered list with tuples of selected row ranges. the range is inclusive.
- current_row¶
the current row in the list if a cell is active
- current_column¶
the current column in the table if a cell is active
- current_field_name¶
the name of the field displayed in the current column
- session¶
The session to which the objects in the list belong.
- field_attributes¶
The field attributes of the field to which the list relates, for example the attributes of Person.addresses if the list is the list of addresses of the Person.
The collection_count and selection_count attributes allow the model_run() to quickly evaluate the size of the collection or the selection without calling the potentially time consuming methods get_collection() and get_selection().
- class camelot.admin.action.list_action.ListContextAction[source]¶
An base class for actions that should only be enabled if the gui_context is a ListActionModelContext
- class camelot.admin.action.list_action.OpenFormView[source]¶
Open a form view for the current row of a list.
- class camelot.admin.action.list_action.RemoveExportMapping(settings)[source]¶
Remove a user defined order of columns to export
- class camelot.admin.action.list_action.RemoveSelection[source]¶
Remove the selected objects from a list without deleting them
- class camelot.admin.action.list_action.ReplaceFieldContents[source]¶
Select a field an change the content for a whole selection
- class camelot.admin.action.list_action.RestoreExportMapping(settings)[source]¶
Restore the user defined order of columns to export
- class camelot.admin.action.list_action.RowNumberAction[source]¶
An action that simply displays the current row number as its name to the user.