### Navigation

- index
- modules |
- next |
- previous |
- Camelot documentation »
- Camelot API »
- admin »
- action »

# form_action

class `camelot.admin.action.form_action.``FormActionGuiContext`

  The context for an `Action` on a form. On top of the attributes of the `camelot.admin.action.application_action.ApplicationActionGuiContext`, this context contains :

  `widget_mapper`

    the `QtGui.QDataWidgetMapper` class that relates the form widget to the model.

  `model_context`

    alias of `FormActionModelContext`

class `camelot.admin.action.form_action.``FormActionModelContext`

  On top of the attributes of the `camelot.admin.action.application_action.ApplicationActionModelContext`, this context contains :

  `current_row`

    the row in the list that is currently displayed in the form

  `collection_count`

    the number of objects that can be reached in the form.

  `selection_count`

    the number of objects displayed in the form, at most 1.

  `session`

    The session to which the objects in the list belong.

  The `selection_count` attribute allows the `model_run()` to quickly evaluate the size of the collection without calling the potetially time consuming method `get_collection()`.

  `get_collection`(yield_per=None)

    Parameters: | yield_per – an integer number giving a hint on how many objects should fetched from the database at the same time.
    Returns: | a generator over the objects in the list

  `get_object`()

    Returns: | the object currently displayed in the form, None if no object

    is displayed yet

  `get_selection`(yield_per=None)

    Method to be compatible with a `camelot.admin.action.list_action.ListActionModelContext`, this allows creating a single Action to be used on a form and on list.

    Parameters: | yield_per – this parameter has no effect, it’s here only for compatibility with `camelot.admin.action.list_action.ListActionModelContext.get_selection()`
    Returns: | a generator that yields the current object displayed in the form and does not yield anything if no object is displayed yet in the form.

`camelot.admin.action.form_action.``structure_to_form_actions`(structure)

  Convert a list of python objects to a list of form actions. If the python object is a tuple, a CallMethod is constructed with this tuple as arguments. If the python object is an instance of as Action, it is kept as is.

### Navigation

- index
- modules |
- next |
- previous |
- Camelot documentation »
- Camelot API »
- admin »
- action »

Comments
blog comments powered by Disqus