{"id":21148,"library":"django-fsm-log","title":"django-fsm-log","description":"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.","status":"active","version":"5.0.2","language":"python","source_language":"en","source_url":"https://github.com/jazzband/django-fsm-log","tags":["django","fsm","state-machine","logging","jazzband"],"install":[{"cmd":"pip install django-fsm-log","lang":"bash","label":"Standard install"}],"dependencies":[{"reason":"Replaced django-fsm in v4.0.0, breaking backward compatibility with older django-fsm","package":"django-fsm-2","optional":false},{"reason":"Required framework, version >=3.2","package":"Django","optional":false}],"imports":[{"wrong":"from django_fsm_log.mixins import FSMLogMixin","symbol":"FSMLogMixin","correct":"from django_fsm_log import FSMLogMixin"}],"quickstart":{"code":"from django.db import models\nfrom django_fsm import FSMField, transition\nfrom fsm_log.mixins import FSMLogMixin\n\nclass Article(FSMLogMixin, models.Model):\n    title = models.CharField(max_length=100)\n    content = models.TextField()\n    state = FSMField(default='draft', protected=True)\n\n    @transition(field=state, source='draft', target='published')\n    def publish(self):\n        pass\n\n# usage\narticle = Article.objects.create(title='Test', content='...')\narticle.publish()\narticle.save()\nfrom fsm_log.models import StateLog\nlog_entries = StateLog.objects.filter(object_id=article.pk)\nprint(log_entries.count())  # >0","lang":"python","description":"Add FSMLogMixin to your model and every transition will be logged automatically to StateLog."},"warnings":[{"fix":"Run 'pip uninstall django-fsm' and ensure django-fsm-2 is installed.","message":"v4.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.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use Python >=3.9 and Django >=3.2 (but <5.2 for now).","message":"v4.0.0 dropped support for Python 3.7, 3.8 and Django 2.2, 4.0. Upgrade your environment if needed.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Import 'StateLog' from 'fsm_log.models' instead.","message":"The model class used to be called 'FSMStateLog' in versions <3.x. In current versions it is 'StateLog'.","severity":"deprecated","affected_versions":"<5.0.0"},{"fix":"Always define your model as 'class MyModel(FSMLogMixin, models.Model):' - mixin first.","message":"FSMLogMixin must be placed before 'models.Model' in the class inheritance, otherwise the mixin's save method may not get called.","severity":"gotcha","affected_versions":"All"},{"fix":"Ensure 'fsm_log_description' is on top of 'transition': @fsm_log_description('desc')\\n@transition(...)","message":"The decorator 'fsm_log_description' must be placed above @transition, not below, otherwise it won't capture the description.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"search_vec":"'2':34 '3.13':27 '3.2':23 '3.9':26 '5.0.2':20 '5.1':24 'django':2,7,17,22,32,41 'django-fsm':16,31 'django-fsm-log':1 'fsm':3,18,33,42 'jazzband':37,47 'librari':8 'lightweight':6 'log':4,10,46 'machin':45 'model':14 'month':39 'patch':40 'python':25 'releas':35 'state':11,44 'state-machin':43 'support':21 'switch':29 'transit':12 'use':15 'version':19 'via':36","created_at":"2026-04-27T16:58:20.313987+00:00","updated_at":"2026-04-27T16:58:20.313987+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nImportError: cannot import name 'FSMLogMixin' from 'django_fsm_log' (/tmp/tmp7kjc80gg/venv/lib/python3.12/site-packages/django_fsm_log/__init__.py)"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"5.0.2","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/jazzband/django-fsm-log","docs":"https://django-fsm-log.readthedocs.io/en/latest/","changelog":null,"pypi":"https://pypi.org/project/django-fsm-log/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}