Skip to main content

A Django app to different handle notification types.

Project description

Django Dans Notifications

Lint Test Python codecov

Description

A Django app to handle notifications.

Support for basic notifications, push notifications and email notifications.

Quick start

  1. Add "django_dans_notifications" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
	...
	'django_dans_notifications',
]
  1. Include the notifications URLconf in your project urls.py for the REST API endpoints like this:
path("api/notifications/", include("django_dans_notifications.urls")),
  1. Run python manage.py migrate to create the models.

  2. 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 and DEFAULT_PAGINATION_CLASS in your settings.py to work with the APIs properly. An example config would be:
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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-dans-notifications-1.1.15.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_dans_notifications-1.1.15-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

Details for the file django-dans-notifications-1.1.15.tar.gz.

File metadata

File hashes

Hashes for django-dans-notifications-1.1.15.tar.gz
Algorithm Hash digest
SHA256 0ecd123a7b931d606714691ad18195e5abc47e0ae8eb1a5b7cdbad988bccc561
MD5 cc9e61c7947eaa9c2844ce009b1fc4c4
BLAKE2b-256 6db28f4f0dc58ec6d83628f949da499cd4eec923045353cfe4e6b5941c81ae90

See more details on using hashes here.

File details

Details for the file django_dans_notifications-1.1.15-py3-none-any.whl.

File metadata

File hashes

Hashes for django_dans_notifications-1.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 4441c61bb5f1e235c84714b413432b0d5f75988a1066def24d8a2412784c91fd
MD5 5cbf6cb544df1625b59cdb016c965f5e
BLAKE2b-256 5c8f92af91b1a7ee240bb31017df0bd757936d357056780590586bd14815bf25

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page