Metadata-Version: 2.4
Name: django-notifications-rest
Version: 1.1.0
Summary: A django notifications package exposed through API Rest
Home-page: https://github.com/yhdelgado/django-notifications-rest
Author: Yusniel Hidalgo Delgado
Author-email: yhidalgo86@gmail.com
License: MIT
Keywords: django notifications github rest api
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Framework :: Django
Classifier: Framework :: Django :: 5.2
Classifier: Framework :: Django :: 6.0
Classifier: Framework :: Django :: 6.1
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Utilities
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: requires-python
Dynamic: summary

``django-notifications-rest`` Documentation
=======================================

[django-notifications-rest](https://github.com/yhdelgado/django-notifications-rest) provides rest endpoints for ``django-notifications-hq``.

Requirements
============

- Python 3.11 - 3.14
- Django 5.2 - 6.1
- [django-notifications-community](https://github.com/django-notifications-community/django-notifications-community) latest version.
  It is a drop-in fork of ``django-notifications-hq``, whose last PyPI release (1.8.3) does not run on Django 5.1+ or Python 3.12+.
- djangorestframework latest version

Installation
============

Installation using ``pip``. You need to manually install the required ``django-notifications-community`` and ``djangorestframework`` packages.
    
    $ pip install django-notifications-rest

or get it from source

    $ git clone https://github.com/yhdelgado/django-notifications-rest.git
    $ cd django-notifications-rest
    $ python setup.py sdist
    $ pip install dist/django-notifications-rest*

Then to add the Django Notifications Rest to your project add the app ``notifications_rest`` to your ``INSTALLED_APPS`` and urlconf.

The app should go somewhere after all the apps that are going to be generating notifications like ``django.contrib.auth``

    INSTALLED_APPS = (
        'django.contrib.auth',
        'rest_framework',
        'notifications'.
        ...
        'notifications_rest',
        ...
    )

Add the notifications urls to your urlconf::

    urlpatterns = [
        ...
        url('^notifications/', include('notifications_rest.urls')),
        ...
    ]
If the installed version of django>=3.1, then::

    from django.urls import path, include
    urlpatterns = [
        ...
        path('^notifications/', include('notifications_rest.urls')),
        ...
    ]
 
To run schema migration, execute ``python manage.py migrate``.

-------------------
Additional options:
-------------------

There is also ``/add/`` API endpoint to add new notifications. Such endpoint might be considered security risk, as any user can add any notifications. For that reason, it must be manually enabled by setting ``NOTIFICATIONS_API_ALLOW_ADD=True``

The ``recipient`` must be an existing user. ``actor``, ``target`` and ``action_object`` are given as ``{"content_type_id": ..., "pk": ...}``; each must be the requesting user, or an object of a model the requesting user has Django's ``view`` permission for (superusers have all permissions). Anything else is rejected with 400, the same as an object that does not exist.

## `django-notifications-rest` Team

Core contributors (in alphabetical order):

-   [Petr Dlouhý](https://github.com/PetrDlouhy)
-   [Yusniel Hidalgo Delgado](https://github.com/yhdelgado)
