Skip to main content
Documentation Status Maintained https://static.pepy.tech/personalized-badge/drf-messages?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads&service=github

Use Django’s Messages Framework with Django Rest Framework.

Requirements:

  • Python (3.7, 3.8, 3.9)

  • Django (2.2, 3.0, 3.1, 3.2)

  • Django Rest Framework (3.7-3.12)

Django’s message framework is awesome, and now its even better with Django Rest Framework!

The django’s messages framework is a very easy and quick way to provide one-time messages for the user. When using django rest framework you loose most of the functionality of it. Using this app you can access your messages though a rest api endpoint.

Features

  • Persistent message storage in database

  • Automatic cleanup

  • DRF endpoint for accessing messages

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.

Getting help

In case you have trouble while using this module, you may use the GitHub Disccussion.

For any bug or issue, open a new GitHub Issue.

Contributing

Metadata

Release files for drf-messages 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for drf-messages 1.1.1
File Size Uploaded
drf-messages-1.1.1.tar.gz 12.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for drf-messages 1.1.1
File Interpreter ABI Platform
drf_messages-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 26.1 kB

Release files / drf-messages-1.1.1.tar.gz

Download URL drf-messages-1.1.1.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2860dd0f6c6e539715b12798faba5a7cbc9e46b55dd8f727f2ae0762ae39f137
BLAKE2b-256 checksum
How to use checksums
5dc342892fe5e232b0c1f4f882fe52ad390b536940e8270155faed0e613201f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release files / drf_messages-1.1.1-py3-none-any.whl

Download URL drf_messages-1.1.1-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0cf13aa1a5769768d80554949875dc482715a431ed5a2f0d8ce75b108ccf1d41
BLAKE2b-256 checksum
How to use checksums
06ca482f6cdd4e90d937847fe70fbed118348550bd7aed3d7c0f54d5847c043e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page