# django-whistle
Django Whistle is a Django app that provides a simple way to send notifications via different channels.
Currently supports `web`, `push`, `email` channels.
## Basic Usage
1. **Installation**: Install Django Whistle using pip:
```bash
pip install django-whistle
```
2. **Configuration in settings**: Add 'whistle' to your `INSTALLED_APPS` in the Django project settings:
```python
# settings.py
INSTALLED_APPS = [
# ...
'whistle',
]
```
## Configuration
Customize Django Whistle by configuring settings in your project's `settings.py`:
### Basics
Setup events and channels for notifications like this:
**Pro tip**, you can use TextChoices for events.
```python
# settings.py
WHISTLE_CHANNELS = ['web', 'push', 'email']
WHISTLE_NOTIFICATION_EVENTS = (
('NAME_OF_EVENT', gettext_lazy('Object %(object)r was updated')
)
```
```python
### Custom Notification Manager/Handlers
You can ovverride the logic of sending notifications by creating custom manager or handler. Handler is for general
availability of event/channel, and managers is for defining the behaviour. For example, you can use it to customize
emails, add context to emails, or for whatever you miss in the default implementation.
```python
# settings.py
WHISTLE_EMAIL_MANAGER_CLASS = "bidding.notifications.managers.CustomEmailManager"
WHISTLE_NOTIFICATION_MANAGER_CLASS = (
"bidding.notifications.managers.CustomNotificationManager"
)
WHISTLE_AVAILABILITY_HANDLER = "bidding.notifications.handlers.availability_handler"
```
### Asynchronous Notifications
You can send notifications asynchronously using queues.
```python
# settings.py
WHISTLE_REDIS_QUEUE = None
WHISTLE_USE_RQ = False
RQ_QUEUES = None
WHISTLE_CACHE_TIMEOUT = None # infinite
```
## Running the tests
Explain how to run the automated tests for this system
### Break down into end to end tests
Explain what these tests test and why
```
Give an example
```
### And coding style tests
Explain what these tests test and why
```
Give an example
```
## Deployment
Add additional notes about how to deploy this on a live system
## Built With
* [Dropwizard](http://www.dropwizard.io/1.0.2/docs/) - The web framework used
* [Maven](https://maven.apache.org/) - Dependency Management
* [ROME](https://rometools.github.io/rome/) - Used to generate RSS Feeds
## Contributing
Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of
conduct, and the process for submitting pull requests to us.
## Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see
the [tags on this repository](https://github.com/your/project/tags).
## Authors
* **Billie Thompson** - *Initial work* - [PurpleBooth](https://github.com/PurpleBooth)
See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.
## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
## Acknowledgments
* Hat tip to anyone who's code was used
* Inspiration
* etc
Raw data
{
"_id": null,
"home_page": "https://github.com/PragmaticMates/django-whistle",
"name": "django-whistle",
"maintainer": "Pragmatic Mates",
"docs_url": null,
"requires_python": null,
"maintainer_email": "info@pragmaticmates.com",
"keywords": "django notifications events push email iOS Android APN FireBase GCM",
"author": "Pragmatic Mates",
"author_email": "info@pragmaticmates.com",
"download_url": "https://files.pythonhosted.org/packages/1b/cf/d86d66ef4cab78f26dd0ab7f21dc66f66c137f2ed7233f3cc34758b5521e/django_whistle-6.0.0.tar.gz",
"platform": null,
"description": "# django-whistle\n\nDjango Whistle is a Django app that provides a simple way to send notifications via different channels.\nCurrently supports `web`, `push`, `email` channels.\n\n## Basic Usage\n\n1. **Installation**: Install Django Whistle using pip:\n\n```bash\npip install django-whistle\n```\n\n2. **Configuration in settings**: Add 'whistle' to your `INSTALLED_APPS` in the Django project settings:\n\n ```python\n # settings.py\n\nINSTALLED_APPS = [\n # ...\n 'whistle',\n]\n ```\n\n## Configuration\n\nCustomize Django Whistle by configuring settings in your project's `settings.py`:\n\n### Basics\n\nSetup events and channels for notifications like this:\n**Pro tip**, you can use TextChoices for events.\n\n```python\n # settings.py\n\nWHISTLE_CHANNELS = ['web', 'push', 'email']\nWHISTLE_NOTIFICATION_EVENTS = (\n ('NAME_OF_EVENT', gettext_lazy('Object %(object)r was updated')\n)\n```\n\n\n```python\n### Custom Notification Manager/Handlers\n\nYou can ovverride the logic of sending notifications by creating custom manager or handler. Handler is for general\navailability of event/channel, and managers is for defining the behaviour. For example, you can use it to customize\nemails, add context to emails, or for whatever you miss in the default implementation.\n\n```python\n# settings.py\n\nWHISTLE_EMAIL_MANAGER_CLASS = \"bidding.notifications.managers.CustomEmailManager\"\nWHISTLE_NOTIFICATION_MANAGER_CLASS = (\n \"bidding.notifications.managers.CustomNotificationManager\"\n)\nWHISTLE_AVAILABILITY_HANDLER = \"bidding.notifications.handlers.availability_handler\"\n```\n\n### Asynchronous Notifications\n\nYou can send notifications asynchronously using queues.\n\n```python\n# settings.py\n\nWHISTLE_REDIS_QUEUE = None\nWHISTLE_USE_RQ = False\nRQ_QUEUES = None\nWHISTLE_CACHE_TIMEOUT = None # infinite\n```\n\n## Running the tests\n\nExplain how to run the automated tests for this system\n\n### Break down into end to end tests\n\nExplain what these tests test and why\n\n```\nGive an example\n```\n\n### And coding style tests\n\nExplain what these tests test and why\n\n```\nGive an example\n```\n\n## Deployment\n\nAdd additional notes about how to deploy this on a live system\n\n## Built With\n\n* [Dropwizard](http://www.dropwizard.io/1.0.2/docs/) - The web framework used\n* [Maven](https://maven.apache.org/) - Dependency Management\n* [ROME](https://rometools.github.io/rome/) - Used to generate RSS Feeds\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of\nconduct, and the process for submitting pull requests to us.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see\nthe [tags on this repository](https://github.com/your/project/tags).\n\n## Authors\n\n* **Billie Thompson** - *Initial work* - [PurpleBooth](https://github.com/PurpleBooth)\n\nSee also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n\n## Acknowledgments\n\n* Hat tip to anyone who's code was used\n* Inspiration\n* etc\n",
"bugtrack_url": null,
"license": "BSD License",
"summary": "Advanced notifications for Django",
"version": "6.0.0",
"project_urls": {
"Homepage": "https://github.com/PragmaticMates/django-whistle"
},
"split_keywords": [
"django",
"notifications",
"events",
"push",
"email",
"ios",
"android",
"apn",
"firebase",
"gcm"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1bcfd86d66ef4cab78f26dd0ab7f21dc66f66c137f2ed7233f3cc34758b5521e",
"md5": "cc5e149a9837a787d3521e697ab5b02e",
"sha256": "fe98426126e2b46ec3662e396b74e255ebbb14d669d5fbf2bc79765910ef5a24"
},
"downloads": -1,
"filename": "django_whistle-6.0.0.tar.gz",
"has_sig": false,
"md5_digest": "cc5e149a9837a787d3521e697ab5b02e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 21267,
"upload_time": "2024-11-22T09:14:06",
"upload_time_iso_8601": "2024-11-22T09:14:06.505598Z",
"url": "https://files.pythonhosted.org/packages/1b/cf/d86d66ef4cab78f26dd0ab7f21dc66f66c137f2ed7233f3cc34758b5521e/django_whistle-6.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-22 09:14:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "PragmaticMates",
"github_project": "django-whistle",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "django-whistle"
}