Quick Start

  1. Install using:

$ pip install drf-messages
  1. Configure project settings.py:

INSTALLED_APPS = [
    # ...
    'django.contrib.messages',
    'rest_framework',
    'drf_messages',
    # ...
]

MESSAGE_STORAGE = "drf_messages.storage.DBStorage"
  1. Configure routes at your project’s urls.py

urlpatterns = [
    path('messages/', include('drf_messages.urls')),
    # ...
]
  1. Run migrations using:

$ py manage.py migrate drf_messages

For more details visit the docs for installation: https://drf-messages.readthedocs.io/en/latest/installation/installation.html

Usage

You can list all your messages with:

$ curl -X GET "http://localhost/messages/"

Any unread messages will have read_at as null. If you have django-filter configured, you can also query “http://localhost/messages/?unread=true” to get only unread messages.