Skip to main content
[![Build Status](https://travis-ci.org/jiaaro/django-alert.png?branch=master)](https://travis-ci.org/jiaaro/django-alert)

## 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)
3. Also add "django.contrib.sites" in installed apps in case it's not there.
4. Run ./manage.py migrate


## 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 django.contrib.auth.models import User
from django.db.models.signals import post_save
from alert.utils import BaseAlert

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.8.1

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.8.1
File Size Uploaded
django-alert-0.8.1.tar.gz 13.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-alert 0.8.1
File Interpreter ABI Platform
django_alert-0.8.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 37.7 kB

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

Download URL django-alert-0.8.1.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
30c065f0d66a78698871c723f6348a329ad52593c8cc096b2afcef04114e8f41
BLAKE2b-256 checksum
How to use checksums
e8722b26dd04220d5ac63b09557e28fe0b89613f35dcc0f9515c6e5e841d9b97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_alert-0.8.1-py2.py3-none-any.whl

Download URL django_alert-0.8.1-py2.py3-none-any.whl
Size 23.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a1f2f9afc0324c44dfa5c171752597f13f07efae68cb7c120be044183bc0914e
BLAKE2b-256 checksum
How to use checksums
0aee4c666679caf2bf2b9f8425e373fe7e4d12ab1d29893fc676bea16b64001d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.8.1 This release

2 release files

0.8.0

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.7

2 release files

0.6.6

1 release file

0.6.5

1 release file

0.6.4

1 release file

0.6.3

1 release file

0.6.2

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.5

1 release file

0.4.4

1 release file

0.4.3

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

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