Skip to main content

A simple Django app to support Notifications.

Project description

=============== Notifications

Notifications is a simple Django app to serve notifications to your users.

To start:

pip install trackwell-notifications

=============== Aknowledgements

The push notification functionality comes from the great work made by the contributers to the fcm-django module, which is subject to an MIT license.

We would've used it straight as a dependency, but it kind of clashed with other functionality of our setup, such as our multi-tenancy and other things, so we had to add the source code directly with a bit of our own modifications.

We do not claim to have written said code (even if we might modify it to our needs) and have added attribution and links in the imported code.

Quick start

  1. pip install trackwell-notifications

  2. Add "notifications" to your INSTALLED_APPS setting like this::

    INSTALLED_APPS = [ ... 'notifications', ]

Make sure it is after the auth etc.::

MIDDLEWARE_CLASSES = (
    ...
    'notifications.middleware.NotificationMiddleware',
)
  1. Put the js and css imports in your base template where you want things to pop up

    <script type="text/javascript" src="{% static "notifications/Notifications.js" %}"></script>
    <link rel="stylesheet" href="{% static "css/notifications.css" %}" type="text/css" />
    

    And also add in a script tag where the location of your notifications endpoint is:

    window.notificationEndpoint = '/api/usernotifications/';  // Don't forget trailing slash
    
  2. Include the polls URLconf in your project urls.py like this::

    path('notifications/', include('notifications.urls')),

  3. Register the api

    from notifications.api.views import NotificationViewSet from notifications.api.views import UserNotificationViewSet

    router.register(r'users', UserViewSet) router.register(r'^users_in_groups', UsersInGroupsViewSet, 'Users in groups')

  4. Run python manage.py migrate to create the notifications models.

  5. Start the development server and visit http://127.0.0.1:8000/admin/notifications

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

trackwell-notifications-4.1.4.tar.gz (27.7 kB view details)

Uploaded Source

Built Distribution

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

trackwell_notifications-4.1.4-py3-none-any.whl (36.4 kB view details)

Uploaded Python 3

File details

Details for the file trackwell-notifications-4.1.4.tar.gz.

File metadata

  • Download URL: trackwell-notifications-4.1.4.tar.gz
  • Upload date:
  • Size: 27.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.2

File hashes

Hashes for trackwell-notifications-4.1.4.tar.gz
Algorithm Hash digest
SHA256 569e8adc5f7404d5b4a36c96cc83fe62a9f0730dacfb4a56d2aeae87cd9f5e32
MD5 42f6891dca0e07a300c22e12cf49a5e2
BLAKE2b-256 99047d22bb50c1ccbe84573218e010b06742a2394ece5b835c9db48e5c26eef6

See more details on using hashes here.

File details

Details for the file trackwell_notifications-4.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for trackwell_notifications-4.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 84437b66318b5b14c2a711498f9a4f9c98d61630e3d201e8039e18a8042b9e7b
MD5 63def80b8b146844b23208fc8c1022c3
BLAKE2b-256 c5b2b8667f0f70adacb65047a2fe1fea1877c9bfe1b1d3bb9836f67c055525ee

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