Django package that handles sending of notifications
Project description
# UNICEF Notification
Notification is a library that provides handles sending of notifications.
## Installation
pip install unicef-notification
## Setup
Add ``unicef_notification`` to ``INSTALLED_APPS`` in ``settings.py``
INSTALLED_APPS = [
...
'unicef_notification',
]
Define the notification template directory to be used;
UNICEF_NOTIFICATION_TEMPLATE_DIR = 'notifications'
This is the directory where notifcation templates are to be placed in your applications.
## Usage
Create notification template in defined `UNICEF_NOTIFICATION_TEMPLATE_DIR` from setup.
name = "<unique name for notification">
defaults = {
"description": "Sample notification",
"subject": "Subject of notification",
"content": "Content of notification",
"html_content": "Notificaton content in HTML format",
}
Update the notifications;
python manage.py update_notifications
Send notification with template;
from unicef_notification.utils import send_notification_with_template
context = {}
send_notification_with_template(
["to@example.com"],
"<name-of-template>",
context,
)
Send notification without a template;
from unicef_notification.utils import send_notification
send_notification(
["to@example.com"],
subject="Subject of notification",
content="Content of notification",
html_content="Notification content in HTML format",
)
## Contributing
### Environment Setup
To install the necessary libraries
$ make install
### Coding Standards
See `PEP 8 Style Guide for Python Code <https://www.python.org/dev/peps/pep-0008/>`_ for complete details on the coding standards.
To run checks on the code to ensure code is in compliance
$ make lint
### Testing
Testing is important and tests are located in `tests/` directory and can be run with;
$ make test
Coverage report is viewable in `build/coverage` directory, and can be generated with;
### Project Links
- Continuos Integration - https://circleci.com/gh/unicef/unicef-notification/tree/develop
- Source Code - https://github.com/unicef/unicef-notification
Notification is a library that provides handles sending of notifications.
## Installation
pip install unicef-notification
## Setup
Add ``unicef_notification`` to ``INSTALLED_APPS`` in ``settings.py``
INSTALLED_APPS = [
...
'unicef_notification',
]
Define the notification template directory to be used;
UNICEF_NOTIFICATION_TEMPLATE_DIR = 'notifications'
This is the directory where notifcation templates are to be placed in your applications.
## Usage
Create notification template in defined `UNICEF_NOTIFICATION_TEMPLATE_DIR` from setup.
name = "<unique name for notification">
defaults = {
"description": "Sample notification",
"subject": "Subject of notification",
"content": "Content of notification",
"html_content": "Notificaton content in HTML format",
}
Update the notifications;
python manage.py update_notifications
Send notification with template;
from unicef_notification.utils import send_notification_with_template
context = {}
send_notification_with_template(
["to@example.com"],
"<name-of-template>",
context,
)
Send notification without a template;
from unicef_notification.utils import send_notification
send_notification(
["to@example.com"],
subject="Subject of notification",
content="Content of notification",
html_content="Notification content in HTML format",
)
## Contributing
### Environment Setup
To install the necessary libraries
$ make install
### Coding Standards
See `PEP 8 Style Guide for Python Code <https://www.python.org/dev/peps/pep-0008/>`_ for complete details on the coding standards.
To run checks on the code to ensure code is in compliance
$ make lint
### Testing
Testing is important and tests are located in `tests/` directory and can be run with;
$ make test
Coverage report is viewable in `build/coverage` directory, and can be generated with;
### Project Links
- Continuos Integration - https://circleci.com/gh/unicef/unicef-notification/tree/develop
- Source Code - https://github.com/unicef/unicef-notification
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
unicef_notification-0.1.0.tar.gz
(15.4 kB
view details)
File details
Details for the file unicef_notification-0.1.0.tar.gz
.
File metadata
- Download URL: unicef_notification-0.1.0.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 764c2d1869315fdbad4b057d4d752f2a5d4266fbe1677a1a9ec06ecec5e253bf |
|
MD5 | 36cc4bdee73a4b9552fd3ea9e9ac1960 |
|
BLAKE2b-256 | 3067e8f3edab48c94b34d4267ed1efc8e1d25565ec59a04678ac0b7754e68780 |