# rsinger86/django-lifecycle

Declarative model lifecycle hooks, an alternative to Signals.

Repository: https://github.com/rsinger86/django-lifecycle
Canonical: https://ross.abutalabs.com/products/django-lifecycle
Homepage: https://rsinger86.github.io/django-lifecycle/
Language: Python
License: MIT
License Family: permissive
Topics: django-models, lifecycle-hooks, django, transition-conditions
Last push: 2026-06-14T10:05:37+00:00

## Health v2 (maintenance only)
Score: 86/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 87, release rhythm 76, longevity 100
- inputs: {"age_days": 3090, "days_push": 80, "days_rel": 80, "gap_med": 35, "n_releases_24m": 4}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1404, forks 96 (observed 2026-08-28T04:04:38.006382+00:00)

## What it is
A Python library providing a @hook decorator and LifecycleModel base class for declarative model lifecycle hooks in Django. It serves as a readable alternative to Django Signals, letting developers attach callbacks to model save/update events with field-change conditions.

## Use cases
- run code when a django model field changes
- replace django signals with declarative model hooks
- send email after a model transitions from draft to published
- avoid overriding save and __init__ in django models
- add before_update and after_update callbacks to django models
- attach transition conditions to model lifecycle events

## When to choose
- you use Django models and want readable, co-located lifecycle callbacks
- you find Django Signals too indirect and want a fat-models approach
- you need conditional hooks based on field value changes or transitions

## When to avoid
- you are not using Django or its ORM
- you need hooks decoupled from model classes across apps, where Signals fit better
- you need hooks on bulk queryset operations that bypass save()

## Facets
- artifact type: library
- maturity: active
- function: middleware, developer-tools
- domain: web-development, backend, developer-tools
- platform: python
- tags: django, lifecycle-hooks, orm, model-hooks, signals-alternative, callbacks, web-server

## Member repositories
- rsinger86/django-lifecycle (main) score 86

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:38.006382+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:38:52.427509+00:00, confidence not recorded.
  - readme: https://github.com/rsinger86/django-lifecycle (fetched 2026-08-28T04:04:38.006382+00:00, sha c1d2ac43d9c0)
  - homepage: https://rsinger86.github.io/django-lifecycle/ (fetched 2026-08-29T11:52:50.192744+00:00, sha 1dfd31d52c6a)
  - registry_pypi: https://pypi.org/pypi/django-lifecycle/json (fetched 2026-08-29T11:52:50.201715+00:00, sha 8b6fc640fbd4)
- Data as of 2026-08-30T08:39:29.467469+00:00.
