Django-Directmessages
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
pip install django-directmessages
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)
Metadata
Release files for django-directmessages 0.9.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django-directmessages-0.9.7.tar.gz | 6.7 kB | Without provenance | Details |
Release files / django-directmessages-0.9.7.tar.gz
| Download URL | django-directmessages-0.9.7.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2fd0ec37f83e57fd9869df1240f3b2e81a50442fe3423c2f59f4b8f5789e689a
|
|
BLAKE2b-256 checksum How to use checksums |
c0534a00fa4d706c5200ac0d37fc2dda7332200584c63ba679d5a063469de076
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-directmessages 0.9.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.