Skip to main content
## Installation ##

1. Install lib with pip:

`pip install django-alert`

**- OR -**

Put the "alert" directory somewhere in your python path

2. Add "alert" to your installed apps (in the settings.py file)


## Making Alerts ##

Create an "alerts.py" file and import it at the bottom of your
models.py file. This is where you will define your alert class. Every
alert is subclassed from "alert.utils.BaseAlert"

Here is an example alert that is sent to users when they first sign up:

from alert.utils import BaseAlert
from django.contrib.auth.models import User

class WelcomeAlert(BaseAlert):
title = 'Welcome new users'
description = 'When a new user signs up, send them a welcome email'

signal = post_save
sender = User

default = False

def before(self, created, **kwargs):
return created

def get_applicable_users(self, instance, **kwargs):
return [instance]


## Writing Alert Backends ##

Alert includes an Email Backend by default. But you can write a backend
for *any* messaging medium!

Alert Backends just need to subclass BaseAlertBackend and implement a
`send()` method that accepts an alert instance

You can copy and paste the following code to get started:

from alert.utils import BaseAlertBackend

class MyAlertBackend(BaseAlertBackend):
def send()


## Signals ##

When an alert is sent, a signal is fired (found in alert.signals). The
"sender" keyword argument is the Alert you defined (WelcomeAlert in
this case).

example:

from alert.signals import alert_sent

def do_something_after_welcome_alert_is_sent(sender, alert, **kwargs):
pass

alert_sent.connect(do_something_after_welcome_alert_is_sent,
sender=WelcomeAlert)

Metadata

Release files for django-alert 0.6.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-alert 0.6.5
File Size Uploaded Provenance Actions
django-alert-0.6.5.tar.gz 16.2 kB Without provenance Details for django-alert-0.6.5.tar.gz

Release files / django-alert-0.6.5.tar.gz

Download URL django-alert-0.6.5.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
21576535d4ccf378d4b0896454fc428f80b9d4c503896ce13439d4b4fe83c2f0
BLAKE2b-256 checksum
How to use checksums
7223baeabce5aa5e8ac13e1f0bb6c426474302e1cd4106c448c47e6b9a91d5f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-alert 0.6.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.5 This release

1 release file No provenance

0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page