This project provides a @hook decorator as well as a base model and mixin to add lifecycle hooks to your Django models. Django's built-in approach to offering lifecycle hooks is Signals. However, my team often finds that Signals introduce unnecessary indirection and are at odds with Django's "fat models" approach. Django Lifecycle Hooks supports Python 3.7, 3.8 and 3.9, Django 2.0.x, 2.1.x, 2.2.x, 3.0.x, 3.1.x, and 3.2.x. For simple cases, you might always want something to happen at a certain point, such as after saving or before deleting a model instance. When a user is first created, you could process a thumbnail image in the background and send the user an email.

Features

  • Requires Python (3.5+)
  • Works with Django (2.0+)
  • Enforce certain disallowed transitions
  • Base model and mixin to add lifecycle hooks to your Django models
  • Django's built-in approach to offering lifecycle hooks is Signals
  • You can write model code instead of overriding save and __init__ in a clunky way

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow Django Lifecycle Hooks

Django Lifecycle Hooks Web Site

Other Useful Business Software
Full-stack observability with actually useful AI | Grafana Cloud Icon
Full-stack observability with actually useful AI | Grafana Cloud

Our generous forever free tier includes the full platform, including the AI Assistant, for 3 users with 10k metrics, 50GB logs, and 50GB traces.

Built on open standards like Prometheus and OpenTelemetry, Grafana Cloud includes Kubernetes Monitoring, Application Observability, Incident Response, plus the AI-powered Grafana Assistant. Get started with our generous free tier today.
Create free account
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Django Lifecycle Hooks!

Additional Project Details

Programming Language

Python

Related Categories

Python Software Development Software, Python Frameworks

Registered

2022-09-05