Lightweight Django package for real-time team notifications on model events.
Project description
django-team-events
Automatic Django Model Activity Notifications
Lightweight Django package for real-time team notifications on model events.
Install
·
Quick Start
·
Configuration
·
Roadmap
📌 About The Project
django-team-events is a lightweight Django package that automatically sends notifications to your team when important model events occur — such as create, update, or delete.
Built for startup teams and product-driven environments where:
- Important user actions shouldn’t go unnoticed
- Developers don’t want to poll Django admin
- Business logic shouldn’t be cluttered with notification code
- Setup must be simple and predictable
This package uses Django signals under the hood and provides per-model granular configuration, giving you clean integration without modifying your core logic.
V1 supports:
- ✅ Google Chat (Incoming Webhooks)
- 🔒 Automatic sensitive field exclusion
- 🎨 Customizable message templates
- 🧠 Smart field diff detection
- 🛡 Safe, non-blocking delivery
Slack support is planned in upcoming releases.
✨ Features
- Signal-based model tracking
- Per-model configuration via
TeamEvents - Automatic detection of created vs updated vs deleted
- Field-level include/exclude controls
- Automatic exclusion of common sensitive fields
- Clean default message formatting
- Customizable message templates
- Webhook-based configuration (via environment variables)
- Never breaks your request cycle
📦 Installation
pip install django-team-events
Add to your Django settings:
INSTALLED_APPS = [
...
"django_team_events",
]
🔐 Environment Configuration
Getting Your Google Chat Webhook URL
- Open Google Chat and go to the Space (channel) where you want notifications
- Click the Space name at the top → Apps & integrations
- Click Add webhooks
- Give it a name (e.g.
django-team-events) and optionally an avatar URL - Click Save — copy the generated webhook URL
Add to your settings.py:
DJANGO_TEAM_EVENTS = {
"GCHAT_WEBHOOK": "https://chat.googleapis.com/v1/spaces/XXXXX/messages?key=...",
}
Do not hardcode webhooks in your codebase.
⚡ Quick Start
1️⃣ Add TeamEvents to Your Model
from django.db import models
from django_team_events import TeamEvents
class User(models.Model):
email = models.EmailField()
name = models.CharField(max_length=255)
team_events = TeamEvents(
notify_on=["create", "update", "delete"],
exclude_fields=["last_login"],
)
def __str__(self):
return self.email
That’s it.
Whenever this model is created, updated, or deleted, your team will receive a notification in Google Chat.
🔔 Default Message Format
Create
🔔 [User] Created
ID: 12
Object: haris@example.com
Time: 2026-02-27 14:30
Update
✏️ [User] Updated
ID: 12
Changes:
- name: Haris → Syed Haris
Delete
🗑 [User] Deleted
ID: 12
Object: haris@example.com
🎨 Custom Message Templates
You can override default formatting using templates:
class Agency(models.Model):
name = models.CharField(max_length=255)
owner = models.CharField(max_length=255)
team_events = TeamEvents(
notify_on=["create", "update"],
template={
"create": "🚀 New Agency Registered: {name} by {owner}",
"update": "✏️ Agency {name} was updated",
},
include_fields=["name", "owner"],
)
def __str__(self):
return self.name
Templates use Python .format() style and can reference model fields.
⚙️ Configuration Options
| Option | Description |
|---|---|
notify_on |
List of actions: "create", "update", "delete" |
include_fields |
Explicit fields to include |
exclude_fields |
Fields to ignore |
template |
Custom message per action |
🔒 Sensitive Field Handling
The following field names are automatically excluded:
- password
- token
- secret
- api_key
- access_key
You can override this using include_fields or exclude_fields.
⚠️ Limitations (v0.1.0)
- Bulk updates are not tracked
- Async delivery not included
- Single Google Chat channel only
- No conditional routing
- No Slack support (yet)
🛡 Design Guarantees
- Webhook failures will not crash your application
- No transaction rollbacks
- No recursive signal loops
- Minimal dependencies
🗺 Roadmap
- Slack webhook provider
- Async support (Celery integration)
- Multiple channel routing
- Conditional rules
- Admin dashboard
- Rich message formatting
🧪 Development
Clone the repository:
git clone https://github.com/yourusername/django-team-events.git
cd django-team-events
pip install -e .
Run tests:
pytest
🤝 Contributing
Contributions are welcome.
Before submitting a PR:
- Add tests
- Use type hints
- Keep dependencies minimal
- Maintain backward compatibility
📄 License
Distributed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_team_events-0.1.0.tar.gz.
File metadata
- Download URL: django_team_events-0.1.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7246f3c3e98e53f6edb5c8e8f0b43be15d3af37e51fa49ac15bfbe5ecbb6fc98
|
|
| MD5 |
fc24da5407bf08999873309328b5b974
|
|
| BLAKE2b-256 |
e63fd69680479160fb8c91847720b4d635701de32a3e0c4244f307602be4adac
|
File details
Details for the file django_team_events-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_team_events-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cdd2fadfebea52f3c0c5992fdafcd2e0f5ee10f46ec900c6fb90a1e9e74d42a
|
|
| MD5 |
fd9c786ee7751fc39ff7a294aa2999d8
|
|
| BLAKE2b-256 |
5d26166b0e4eb64dc73e4d514aec21c34147de1deab36ea968ab6f8ec4e5250e
|