Registry / database / django-fsm-log

django-fsm-log

JSON →
library5.0.2pypypiunverified

A lightweight Django library that logs state transitions for models using django-fsm. Version 5.0.2 supports Django 3.2–5.1, Python 3.9–3.13, and switched to django-fsm-2. Released via Jazzband with monthly patches.

pip install django-fsm-log
INSTALL
IMPORT
SIG · DJANGO-FSM-LOG
D
django-fsm-log
databasepythonv5.0.2
Install
3.7s avg
Import
—
Disk
66MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v5.0.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 66.8MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 3.7s · import 0.000s · 67MB
66MB installed
● package 66MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FSMLogMixin
✓ from django_fsm_log import FSMLogMixin
✗ from django_fsm_log.mixins import FSMLogMixin

Add FSMLogMixin to your model and every transition will be logged automatically to StateLog.

from django.db import models from django_fsm import FSMField, transition from fsm_log.mixins import FSMLogMixin class Article(FSMLogMixin, models.Model): title = models.CharField(max_length=100) content = models.TextField() state = FSMField(default='draft', protected=True) @transition(field=state, source='draft', target='published') def publish(self): pass # usage article = Article.objects.create(title='Test', content='...') article.publish() article.save() from fsm_log.models import StateLog log_entries = StateLog.objects.filter(object_id=article.pk) print(log_entries.count()) # >0
Debug
Known issues
breakingv4.0.0 switched from django-fsm to django-fsm-2 as a dependency. If you have django-fsm pinned in your requirements, uninstall it and use django-fsm-2 instead.
fix
Run 'pip uninstall django-fsm' and ensure django-fsm-2 is installed.
affects: >=4.0.0
breakingv4.0.0 dropped support for Python 3.7, 3.8 and Django 2.2, 4.0. Upgrade your environment if needed.
fix
Use Python >=3.9 and Django >=3.2 (but <5.2 for now).
affects: >=4.0.0
deprecatedThe model class used to be called 'FSMStateLog' in versions <3.x. In current versions it is 'StateLog'.
fix
Import 'StateLog' from 'fsm_log.models' instead.
affects: <5.0.0
gotchaFSMLogMixin must be placed before 'models.Model' in the class inheritance, otherwise the mixin's save method may not get called.
fix
Always define your model as 'class MyModel(FSMLogMixin, models.Model):' - mixin first.
affects: All
gotchaThe decorator 'fsm_log_description' must be placed above @transition, not below, otherwise it won't capture the description.
fix
Ensure 'fsm_log_description' is on top of 'transition': @fsm_log_description('desc')\n@transition(...)
affects: All
Upgrade
Version history
5.0.2latest on PyPI · released Jan 27, 2026
Audit
Dependencies
django-fsm-2requiredReplaced django-fsm in v4.0.0, breaking backward compatibility with older django-fsm
DjangorequiredRequired framework, version >=3.2
Agent activity
14 hits · last 30 days
node
14
Resources
django-fsm-log — pip install django-fsm-log · libregistry