Package form_action
source code
Form actions are objects that can be put in the form_actions list of the
object admin interfaces. Those actions then appear on the form and can
be executed by the end users. The most convenient method to create custom actions
is to subclass FormAction and implement a custom run method
class MyAction(FormAction):
def run(self, entity_getter):
print 'Hello World'
class Movie(Entity):
title = Field(Unicode(60), required=True)
Admin(EntityAdmin):
list_display = ['title']
form_actions = [MyAction('Hello')]
Several subclasses of FormAction exist to provide common use cases such as executing
a function in the model thread or printing a report.
To customize the look of the action button on the form, the render method should be
overwritten.
|
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 FormActionFromGuiFunction is constructed with this tuple as arguments. If
the python object is an instance of a FormAction, it is kept as is. |
source code
|
|
|
__package__ = ' Camelot.camelot.admin.form_action '
|