django-lifecycle
Declarative model lifecycle hooks.
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has low install friction, carries no known vulnerabilities, and solves a real readability problem in Django projects. It's a straightforward drop-in for teams that find Signals cumbersome and prefer declarative, co-located lifecycle logic. The MIT license imposes no restrictions.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction install with a single runtime dependency (Django).
- Active maintenance as of 2026-06-14 with 1405 repository stars and recent releases.
License · maintenance · safety
MIT (permissive) — MIT license (permissive) — you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.
last release 2026-06-14 (61 days) · last repo commit 2026-06-14 · 1,405 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 257,820 downloads/mo, #8,434 on PyPI
Alternatives
Verify before relying
pip install django-lifecycle
from django_lifecycle import LifecycleModel, hook, BEFORE_UPDATE
from django_lifecycle.conditions import WhenFieldHasChanged
class Article(LifecycleModel):
contents = models.TextField()
updated_at = models.DateTimeField(null=True)
@hook(BEFORE_UPDATE, WhenFieldHasChanged("contents", has_changed=True))
def on_content_change(self):
self.updated_at = timezone.now()- Whether the package supports Python 3.14 as a stable release or only as a pre-release target
- Whether Django 6.0 is currently released or a future version target
What it is and what it does
Django Lifecycle Hooks provides a decorator-based alternative to Django Signals for attaching code to model lifecycle events. Instead of overriding save() or __init__ and manually tracking field changes, you decorate methods with @hook and specify when they should run (before/after create, update, or delete) and under what conditions. The package includes a LifecycleModel base class and condition helpers like WhenFieldHasChanged and WhenFieldValueIs to express complex logic declaratively.
The main appeal is readability and maintainability: lifecycle logic stays close to the model definition rather than scattered across signal handlers. It works with Django 4.2, 5.0, 5.2, and 6.0, and supports Python 3.8 through 3.14. The package has been in active development since 2018 and carries no known security vulnerabilities.
Use it for
- Automatically update a timestamp field whenever a model's content changes, without overriding save().
- Trigger side effects (like sending emails) only when a model transitions between specific states (e.g., draft to published).
- Run validation or cleanup logic before or after a model is created, updated, or deleted, with fine-grained conditions.
- Track field changes and react to them in the same model class, keeping related logic together and readable.
- Replace Signal handlers for simple lifecycle events when you want less indirection and clearer code flow.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has low install friction, carries no known vulnerabilities, and solves a real readability problem in Django projects. It's a straightforward drop-in for teams that find Signals cumbersome and prefer declarative, co-located lifecycle logic. The MIT license imposes no restrictions.
Install
django-lifecycle on PyPI
Before you install
Low friction install with a single runtime dependency (Django). Active maintenance as of 2026-06-14 with 1405 repository stars and recent releases.
License in practice
MIT license (permissive) — you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.
Quickstart
pip install django-lifecycle
from django_lifecycle import LifecycleModel, hook, BEFORE_UPDATE
from django_lifecycle.conditions import WhenFieldHasChanged
class Article(LifecycleModel):
contents = models.TextField()
updated_at = models.DateTimeField(null=True)
@hook(BEFORE_UPDATE, WhenFieldHasChanged("contents", has_changed=True))
def on_content_change(self):
self.updated_at = timezone.now()
Verify before relying
- Whether the package supports Python 3.14 as a stable release or only as a pre-release target
- Whether Django 6.0 is currently released or a future version target
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packageDjango |
| Maintenance | Actively maintained 61 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 257,820 / month, #8,434 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.2Framework :: Django :: 6.0License :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: django_lifecycle-1.3.0-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 model lifecycle hooks”
- django-lifecycleAdds declarative lifecycle hooks to Django models via a @hook…
- django-signal-webhooksAdds webhook support to Django models by automatically triggering…
- django-prometheusExports Django application metrics (requests, database queries, cache…
Give your agent the search over MCP, or paste the wish link into any chat.
More Application Frameworks packages
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Textual is a Python framework for building cross-platform user interfaces that run in the terminal or web browser using a modern, component-based API.
Install it if you're developing CLI tools, dashboards, or interactive terminal applications.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Build and connect to Model Context Protocol servers that expose tools, resources, and prompts to LLM applications over stdio, HTTP, or SSE transports.
Install it if you need to build or connect to servers.
Werkzeug is a WSGI utility library providing request/response objects, URL routing, an interactive debugger, HTTP utilities, and a development server for building web applications.
See also django-dirtyfields · django-signal-webhooks · snapshot-restore-py · django-fsm-2 · django-click · django-upgrade · django-fsm-log · django-ordered-model · django-waffle · django-admin-extra-buttons