-
-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#170] Support statically defined hooks
- Loading branch information
Showing
28 changed files
with
1,266 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
.. _transition-meta-administration: | ||
|
||
Dynamic Hook Administration | ||
=========================== | ||
|
||
OnTransitHook | ||
------------- | ||
+---------------------------+------------+----------+--------------------+-------------------------------------------+ | ||
| Field | Default | Optional | Format | Description | | ||
+===========================+============+==========+====================+===========================================+ | ||
| workflow | | | Workflow | | Your model class along with the field | | ||
| | | | | | that you want to use this transition | | ||
| | | False | | | approval meta for. ``django-river`` | | ||
| | | | | | will list all the possible model and | | ||
| | | | | | fields you can pick on the admin page | | ||
+---------------------------+------------+----------+--------------------+-------------------------------------------+ | ||
| callback_function | | False | Function | | Call back function model object that | | ||
| | | | | | contains the name and the body | | ||
+---------------------------+------------+----------+--------------------+-------------------------------------------+ | ||
| transition_meta | | False | TransitionMeta | | The meta of the transition that the | | ||
| | | | | | callback function will be executed | | ||
| | | | | | for | | ||
+---------------------------+------------+----------+--------------------+-------------------------------------------+ | ||
| hook_type | | False | BEFORE or AFTER | | When the call back should be executed | | ||
+---------------------------+------------+----------+--------------------+-------------------------------------------+ | ||
| workflow_object | None | True | ModelWithStateField| | Your model object. This field is | | ||
| | | | | | When it is provided, the call back for | | ||
| | | | | | the transition will only be executed for| | ||
| | | | | | the given model object | | ||
+---------------------------+------------+----------+--------------------+-------------------------------------------+ | ||
|
||
|
||
OnApprovedHook | ||
-------------- | ||
+---------------------------+------------+----------+--------------------+--------------------------------------------------+ | ||
| Field | Default | Optional | Format | Description | | ||
+===========================+============+==========+====================+==================================================+ | ||
| workflow | | | Workflow | | Your model class along with the field | | ||
| | | | | | that you want to use this transition | | ||
| | | False | | | approval meta for. ``django-river`` | | ||
| | | | | | will list all the possible model and | | ||
| | | | | | fields you can pick on the admin page | | ||
+---------------------------+------------+----------+---------------------------+-------------------------------------------+ | ||
| callback_function | | False | Function | | Call back function model object that | | ||
| | | | | | contains the name and the body | | ||
+---------------------------+------------+----------+---------------------------+-------------------------------------------+ | ||
| transition_approval_meta | | False | TransitionApprovalMeta | | The meta of the approval that the | | ||
| | | | | | callback function will be executed | | ||
| | | | | | for | | ||
+---------------------------+------------+----------+---------------------------+-------------------------------------------+ | ||
| hook_type | | False | BEFORE or AFTER | | When the call back should be executed | | ||
+---------------------------+------------+----------+---------------------------+-------------------------------------------+ | ||
| workflow_object | None | True | ModelWithStateField | | Your model object. This field is | | ||
| | | | | | When it is provided, the call back for | | ||
| | | | | | the transition will only be executed for| | ||
| | | | | | the given model object | | ||
+---------------------------+------------+----------+---------------------------+-------------------------------------------+ | ||
|
||
|
||
OnCompleteHook | ||
-------------- | ||
+---------------------------+------------+----------+--------------------+--------------------------------------------------+ | ||
| Field | Default | Optional | Format | Description | | ||
+===========================+============+==========+====================+==================================================+ | ||
| workflow | | | Workflow | | Your model class along with the field | | ||
| | | | | | that you want to use this transition | | ||
| | | False | | | approval meta for. ``django-river`` | | ||
| | | | | | will list all the possible model and | | ||
| | | | | | fields you can pick on the admin page | | ||
+---------------------------+------------+----------+---------------------------+-------------------------------------------+ | ||
| callback_function | | False | Function | | Call back function model object that | | ||
| | | | | | contains the name and the body | | ||
+---------------------------+------------+----------+---------------------------+-------------------------------------------+ | ||
+---------------------------+------------+----------+---------------------------+-------------------------------------------+ | ||
| hook_type | | False | BEFORE or AFTER | | When the call back should be executed | | ||
+---------------------------+------------+----------+---------------------------+-------------------------------------------+ | ||
| workflow_object | None | True | ModelWithStateField | | Your model object. This field is | | ||
| | | | | | When it is provided, the call back for | | ||
| | | | | | the transition will only be executed for| | ||
| | | | | | the given model object | | ||
+---------------------------+------------+----------+---------------------------+-------------------------------------------+ | ||
|
||
.. toctree:: | ||
:maxdepth: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.. _transition-meta-administration: | ||
|
||
Function Administration | ||
======================= | ||
|
||
With dynamically created hookins, functions are kept in DB and they can be managed on an admin interface that django-river already offers out of the box. | ||
You define them once and you can use them within multiple hooks. Just go to ``/admin/river/function/`` admin page and create your functions there. | ||
The admin page also comes with code highlighting if you enable the ``codemirror2`` in the settings. Don't forget to collect statics for production deployments. | ||
|
||
|
||
.. code:: python | ||
INSTALLED_APPS=[ | ||
... | ||
codemirror2 | ||
river | ||
... | ||
] | ||
+-------+---------+----------+----------------------------+-------------+------------------------------+ | ||
| Field | Default | Optional | Format | Description | | | ||
+=======+=========+==========+============================+=============+==============================+ | ||
| name | | False | String ([\w\s]+) | | Name of the function. | | ||
+-------+---------+----------+----------------------------+-------------+------------------------------+ | ||
| body | | False | Valid Python function that | | Function body as string. | | ||
| | | | is named as ``handle`` | | see :ref:`Example Function` | | ||
+-------+---------+----------+----------------------------+-------------+------------------------------+ | ||
|
||
.. toctree:: | ||
:maxdepth: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.