Django Lifecycle

Open source

Django Lifecycle adds a @hook decorator, a base model, and a mixin so Django models can run code at lifecycle moments such as before or after update.

rsinger86.github.io
Django Lifecycle homepage screenshot
GitHub stars
1.4k
Last 30 days
+9(+1%)
Last commit
5 mo ago
Repository age
8 years
Version
1.3.0
Licence
MIT
Self-hosted
Yes

About Django Lifecycle

Django Lifecycle provides a @hook decorator plus a base model class and a mixin for adding lifecycle hooks to Django models. Its authors note that Django's built-in approach is Signals, but their team found Signals add unnecessary indirection and sit at odds with Django's fat models approach.

In the documented example, a model method decorated with a hook runs BEFORE_UPDATE when the contents field has changed, and another runs AFTER_UPDATE when status moves from draft to published. The same logic written by hand needs overridden __init__ and save methods that store original values, which the docs say hurts readability.

It requires Python 3.8 or newer and Django 4.2 or newer, and installs with pip. You either extend LifecycleModel or add LifecycleModelMixin to your model. An optional django_lifecycle_checks app raises an exception if you forget to add the mixin or base class.

Key features

  • A @hook decorator for model methods
  • Conditions such as a field having changed
  • Base model class or mixin for adding hooks
  • Mixin option for existing model definitions
  • Optional check that catches a missing mixin
  • Installs with pip

Good fit for

  • Sending an email when a status changes
  • Updating a timestamp when a field changes
  • Replacing custom save overrides
Tags
django
python
model hooks
orm
library
lifecycle

Django Lifecycle: questions and answers

What is Django Lifecycle used for?
Django Lifecycle adds a @hook decorator, a base model, and a mixin so Django models can run code at lifecycle moments such as before or after update. It is a good fit for sending an email when a status changes, updating a timestamp when a field changes and replacing custom save overrides.
Is Django Lifecycle open source?
Yes. Django Lifecycle is open source under the MIT licence. Its source code is on GitHub at rsinger86/django-lifecycle and is written mainly in Python.
Is Django Lifecycle free?
Yes. Django Lifecycle is open source, so the software itself is free to use.
Can I self-host Django Lifecycle?
Yes. Django Lifecycle can be self-hosted on your own server or infrastructure.
Is Django Lifecycle actively maintained?
The most recent commit to Django Lifecycle was on 14 June 2026, and the latest release is 1.3.0, published on 14 June 2026. The project has 1.4k stars on GitHub, with 9 added in the last 30 days.