Skip to main content

Django-Directmessages is a low-level and easy-to-use Django App to manage simple directmessages.

Project description

Django-Directmessages

https://travis-ci.org/dmonn/django-directmessages.svg?branch=master

Django-Directmessages is a low-level and easy-to-use Django App to manage simple directmessages. In contrast to other Django Apps for messaging, Django-Directmessages doesn’t use any type of pre-built templates and is concentrated on the programmatic usage.

Django-Directmessage is thought to be used with APIs or small apps, but can be used for any type of messaging. It featues:

  • Sending of private 1-to-1 messages between users.

  • Listing unread messages for a given user.

  • Read a given message

  • Get all conversation partners/contacted users for a given user

  • Read a whole conversation between two users.

Requirements

Django >= 1.5 is supported

Installation

  1. pip install django-directmessages

  2. add "directmessages" to INSTALLED_APPS and run python manage.py migrate.

Usage

Import the Message Management API on top of your views.py

from directmessages.apps import Inbox
  • Send message: Inbox.send_message(from_user, to_user, message)

  • List all unread messages: Inbox.get_unread_messages(user)

  • Read a message (and mark as read): Inbox.read_message(message)

  • Print a message as <user>: <message>: Inbox.read_message_formatted(message)

  • Print a list of all conversation partners for a user: Inbox.get_conversations(users)

  • Get a conversation between two users: Inbox.get_conversation(user1, user2, _limit_, _reversed_, _mark_read_)
    • Limit (Int: optional): Instead of getting the whole conversation, get the first 50 (depends on reversed)

    • Reversed (Bool: optional): Usually the ‘limit’-param gives back the first x messages, if you put Reversed to True, limit will give back the x latest messages.

    • Mark_Read (Bool: optional): Mark all messages in conversation as read

Signals

You can use the following signals to extend the app for your needs

  • message_sent:

    Gets called as soon as a message is sent. Provides the Message object, the sender and the recipient as params.

  • message_read:

    Gets called as soon as a message is read: Provides the Message object, the sender and the recipient as params.

Contributing

Bug reports, patches and fixes are always welcome!

To Do

  • Add some security functions (e.g checking if user is allowed to read a message)

  • Add some custom exceptions (e.g. when no message was found)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-full-directmessages-0.9.17.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

django_full_directmessages-0.9.17-py2-none-any.whl (9.1 kB view details)

Uploaded Python 2

File details

Details for the file django-full-directmessages-0.9.17.tar.gz.

File metadata

  • Download URL: django-full-directmessages-0.9.17.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/2.7.10

File hashes

Hashes for django-full-directmessages-0.9.17.tar.gz
Algorithm Hash digest
SHA256 c364448af753c4f640af44460ec5c867fb36c66275f3c6d35334e60649b6aba1
MD5 03f23a612e7f6220dd996af248b7df5d
BLAKE2b-256 e195b8218ff4c1b274972a03f7ac9c4472bc52ffd52548d07c49f81c5ac3f452

See more details on using hashes here.

File details

Details for the file django_full_directmessages-0.9.17-py2-none-any.whl.

File metadata

  • Download URL: django_full_directmessages-0.9.17-py2-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/2.7.10

File hashes

Hashes for django_full_directmessages-0.9.17-py2-none-any.whl
Algorithm Hash digest
SHA256 87b60d9b41be975ee65d096f02bc8c94a3d06e3978eb27b2b3662bbbcd141d4f
MD5 a8aa05bfaef2c8539b49f27d58d6897d
BLAKE2b-256 5781ae61b3a1914375a02f0f5f2b355607a594adb95a423213c2c14236fbb606

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page