Integrate django-fsm state transitions into Django Admin.
Project description
django-fsm-admin-lite
Integrate django-fsm state transitions into Django Admin.
Alternative of django-fsm-admin, with a lighter version of the frontend part.
Features:
- display available transitions in model admin so that user can apply them
- mark FSM protected fields as read only
Limitations:
- transition methods parameters are not handled
Installation
pip install django-fsm-admin-lite
Or, for the latest git version
python -m pip install 'django-fsm-admin-lite @ git+https://github.com/etchegom/django-fsm-admin-lite.git'
Usage
Make you model admin class inherit from the mixin class FSMAdminMixin
.
from django.contrib import admin
from fsm_admin_lite.mixins import FSMAdminMixin
@admin.register(MyModel)
class MyModelAdmin(FSMAdminMixin, admin.ModelAdmin):
fsm_fields = [
"state",
]
Configuration
Admin class attribute | Option |
---|---|
fsm_fields |
List of FSM fields to handle |
fsm_transition_success_msg |
Admin message for transition success |
fsm_transition_error_msg |
Admin message for transition error |
fsm_transition_not_allowed_msg |
Admin message for transition not allowed error |
fsm_transition_not_valid_msg |
Admin message for transition not valid error |
fsm_context_key |
Template context key for FSM transitions |
fsm_post_param |
POST parameter name for FSM transitions |
Run example
make example
Then go to http://127.0.0.1:8000/admin, login with admin
/password
and create a new blog post object.
TODO
- improve the default template files
- display all the transitions (not available transition should be represented as disabled buttons)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django_fsm_admin_lite-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2edd18e9a9c60b0323e49394a68b37b48e8bc50f21f55c2289c4361fb439aa34 |
|
MD5 | 162d1ba5a3e875594c98dba725febfa1 |
|
BLAKE2b-256 | c105e95844e6788af828f9246deef1d98507cd870c07f5421bdb2fea3c2d31db |
Close
Hashes for django_fsm_admin_lite-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66853e39c20be7e34fc7807559a13ac8027b93ea276ab01cb689a0dfd614ab59 |
|
MD5 | fcf7f706dc721b140e8f0eccaf8529b7 |
|
BLAKE2b-256 | 49b1537bfe9b8a4131a09b8d53adad72aae158ff4dc080bb6ce6cafcb6beb525 |