Metadata-Version: 2.1
Name: trackwell-notifications
Version: 4.1.3
Summary: A simple Django app to support Notifications.
Home-page: UNKNOWN
Author: trackwell
Author-email: 
License: NA
Platform: UNKNOWN
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 2.2
Classifier: Framework :: Django :: 3.2
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Description-Content-Type: text/markdown

===============
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](https://github.com/xtrinch/fcm-django), which is subject to an [MIT license](https://github.com/xtrinch/fcm-django/blob/master/LICENSE.txt).

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',
    )

3. 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
    ```


4. Include the polls URLconf in your project urls.py like this::

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

5. 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')


6. Run `python manage.py migrate` to create the notifications models.

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


