A Django app to different handle notification types.
Project description
Django Dans Notifications
Description
A Django app to handle notifications.
Support for basic notifications, push notifications and email notifications.
Quick start
- Add "django_dans_notifications" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
...
'django_dans_notifications',
]
- Include the notifications URLconf in your project urls.py for the REST API endpoints like this:
path("api/notifications/", include("django_dans_notifications.urls")),
-
Run
python manage.py migrate
to create the models. -
Create notifications via the API endpoints, in code or your Admin portal.
Requirements
- Python 3.0 or higher
- Django 3.0 or higher
- Django Rest Framework
- NOTE: not only must you have this installed, you must have set
DEFAULT_AUTHENTICATION_CLASSES
andDEFAULT_PAGINATION_CLASS
in yoursettings.py
to work with the APIs properly. An example config would be:
- NOTE: not only must you have this installed, you must have set
REST_FRAMEWORK = {
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination",
"PAGE_SIZE": 20,
"DEFAULT_AUTHENTICATION_CLASSES": (
"rest_framework.authentication.TokenAuthentication",
),
}
Available Settings
Currently all available settings are optional:
TEAM_NAME
- Default team name to use for emails, can be added to message context manually as well still.IN_TEST
- Whether running in tests or not. Used to determine whether to actually send email.
Usage
The main way to interact with this app is to create and use the appropriate models and their managers' methods as needed.
Also included is the NotificationManager
a class to expose some common functionality and maintain object permissions.
Some of its methods currently are:
- get_notifications_push/email/basic/all
- Enforce object ownership and notification 'direction'
- mark_notification_basic_read
You can also interact directly, so for example to send an email notification:
from django_dans_notifications.models import EmailNotification
email_notification = EmailNotification.objects.send_email(...)
Docs
Model docs.
API docs.
Email Template docs.
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
Hashes for django-dans-notifications-1.1.13.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 700209aa3aabf4cc132c9618d1f6bd2cfe8c8df469ac339eacdbe125cac8859d |
|
MD5 | 1dcf69297db96b3e93fc4b1fc2d81771 |
|
BLAKE2b-256 | 23c4a2b8dde8b02d73cab7964d1ab08fa42626a9122b059944a11b3c5f20118e |
Hashes for django_dans_notifications-1.1.13-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38f550aa382cc0dcb9e4059e46538b0c5c7d38e7c87a8d6821e66e20f7de7d94 |
|
MD5 | ece01e242bfd6343e6eac007a3f072e9 |
|
BLAKE2b-256 | a00513f2b0cb7c26fc7bf5a543b4e482f0c4ff96833282c592bae9585d5783d4 |