Mixin and template tags to integrate django-fsm state transitions into the Django Admin.
Or from GitHub:
- Add
fsm_admin
to yourINSTALLED_APPS
. - Ensure that you have
"django.core.context_processors.request"
in yourTEMPLATE_CONTEXT_PROCESSORS
in Django settings. If the setting variable is not yet defined, add:
- In your
admin.py
file, useFSMTransitionMixin
to add behaviour to your ModelAdmin.FSMTransitionMixin
should be beforeModelAdmin
, the order is important.
It assumes that your workflow state field is named state
, however you can override it or add additional workflow state fields with the attribute fsm_field
.
- By adding
custom=dict(admin=False)
to the transition decorator, one can disallow a transition to show up in the admin interface. This specially is useful, if the transition method accepts parameters without default values, since in django-fsm-admin no arguments can be passed into the transition method.
By adding FSM_ADMIN_FORCE_PERMIT = True
to your configuration settings, the above restriction becomes the default. Then one must explicitly allow that a transition method shows up in the admin interface.
This is useful, if most of your state transitions are handled by other means, such as external events communicating with the API of your application.