django-fsm-2
Django friendly finite state machine support.
Decision gist · record as of 2026-08-14
Yes. This is a well-maintained, actively developed fork of a proven library with no known vulnerabilities, low install friction, and clear production-stable status. Use it if you need to manage model state transitions declaratively in Django; it eliminates scattered state-management code and makes workflows explicit and testable.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later and Django 4.2 or later.
- Low friction install with only three runtime dependencies (django, django-stubs-ext, typing-extensions).
- The package is actively maintained with a recent commit on 2026-08-07 and marked as Production/Stable.
License · maintenance · safety
MIT (permissive) — MIT license (permissive) means you can use this freely in commercial and private projects with minimal restrictions.
last release 2026-03-16 (151 days) · last repo commit 2026-08-07 · 278 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 437,224 downloads/mo, #6,671 on PyPI
Alternatives
Verify before relying
pip install django-fsm-2
from django_fsm import FSMField, FSMModelMixin, transition
class BlogPost(FSMModelMixin, models.Model):
state = FSMField(default='new')
@transition(field=state, source='new', target='published')
def publish(self, **kwargs):
pass
post = BlogPost.objects.get(pk=1)
post.publish()
post.save()- Whether typing support is fully implemented or still planned as mentioned in the description.
- Performance characteristics when managing models with many possible state transitions.
What it is and what it does
Django FSM-2 is a maintained fork of the archived Django FSM project that brings finite state machine patterns to Django models. Instead of storing state as a plain CharField and managing transitions scattered throughout your codebase, you declare states and transitions once using decorators on model methods. This centralizes your model's lifecycle logic in one place, making it easier to reason about valid state changes, enforce preconditions, and attach business logic (side effects, permissions, notifications) to specific transitions.
The package works by providing FSMField (or FSMIntegerField/FSMKeyField variants) to store state, the @transition decorator to define allowed state changes, and helper methods to check permissions and available transitions. Transition methods can contain arbitrary logic; the state changes in memory on success, and you persist it with save(). You can restrict transitions with conditions, attach permissions, specify error-handling states, and use dynamic target states based on method return values.
Use it for
- Managing blog post lifecycle (draft → review → published → archived) with automatic permission and timing checks.
- Enforcing order state workflows (pending → processing → shipped → delivered) with side effects like notifications.
- Controlling document approval flows where transitions require specific user permissions and conditions.
- Building task or ticket systems where state changes trigger notifications or log entries.
- Implementing subscription or account status transitions with business logic tied to each change.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is a well-maintained, actively developed fork of a proven library with no known vulnerabilities, low install friction, and clear production-stable status. Use it if you need to manage model state transitions declaratively in Django; it eliminates scattered state-management code and makes workflows explicit and testable.
Install
django-fsm-2 on PyPI
Before you install
Low friction install with only three runtime dependencies (django, django-stubs-ext, typing-extensions). The package is actively maintained with a recent commit on 2026-08-07 and marked as Production/Stable.
Requires Python 3.10 or later and Django 4.2 or later.
License in practice
MIT license (permissive) means you can use this freely in commercial and private projects with minimal restrictions.
Quickstart
pip install django-fsm-2
from django_fsm import FSMField, FSMModelMixin, transition
class BlogPost(FSMModelMixin, models.Model):
state = FSMField(default='new')
@transition(field=state, source='new', target='published')
def publish(self, **kwargs):
pass
post = BlogPost.objects.get(pk=1)
post.publish()
post.save()
Verify before relying
- Whether typing support is fully implemented or still planned as mentioned in the description.
- Performance characteristics when managing models with many possible state transitions.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesdjango-stubs-extdjangotyping-extensions |
| Maintenance | Actively maintained 151 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 437,224 / month, #6,671 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Framework :: Django :: 6.0Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Libraries :: Python ModulesTyping :: Typed |
Evidence: django_fsm_2-4.2.4-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “django state machine”
- django-fsm-2Adds declarative finite state machine support to Django models,…
- django-fsmProvides finite state machine support for Django models, allowing you…
- django-fsm-logAutomatically logs state transitions for Django FSM models to the…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also automaton · django-fsm · django-fsm-log · django-lifecycle · python-statemachine · fysom · transitions · django-pgtrigger · Automat · django-concurrency