Giter Club home page Giter Club logo

drf-messages's Introduction

drf-messages

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

drf-messages's People

Contributors

danyi1212 avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.