Notification sytem for Django
Project description
Django NotifyX is a reusable app which adds notification system features to your Django app.
- It was inspired from django-notifications , major differences include:
Multipe user notification at once.
A different approach for notification updates.
Less hassles when trying to format notifications differently according to their types.
AJAX support for everything.
And many more.
This is just a quick guide to get things to work ASAP. To dive into the details.. Read the docs
How to install
Downloading the package
Probably the best way to install is by using PIP:
$ pip install django-notify-x
If you want to stay on the bleeding edge of the app:
$ git clone https://github.com/v1k45/django-notify-x.git $ cd django-notify-x $ python setup.py install
Installing it on your project
After the you’ve installed django-notify-x in your python enviroment. You have to make an entry of the same in your project settings.py file:
INSTALLED_APPS = ( ... 'your.other.apps', ... 'notify', )
Then an entry on the urls.py file:
urlpatterns = ( url(r'^notifications/', include('notify.urls', 'notifications')), )
Then run migrations:
$ python manage.py migrate notify
Then collectstatic to make sure you’ve copied the JS file for AJAX functionality:
$ python manage.py collectstatic
You’ve successfully installed django-notify-x!
Sending notifications
Sending notifications to a single user:
from notify.signals import notify
# your example view
def follow_user(request, user):
user = User.objects.get(username=user)
...
dofollow
...
notify.send(request.user, recipient=user, actor=request.user
verb='followed you.', nf_type='followed_by_one_user')
return YourResponse
Easy as pie, isn’t it?
Sending notifications to multiple users:
from notify.signals import notify
# your example view
def upload_video(request):
...
uploadvideo...
...
video = VideoUploader.getupload()
followers = list(request.user.followers())
notify.send(request.user, recipient_list=followers, actor=request.user
verb='uploaded.', target=video, nf_type='video_upload_from_following')
return YourResponse
Just change the recipient to recipient_list and send notifications to as many users you want!
Notification concatenation support
Notification Concatenation is what you see when you read notifications like Bob and 64 others liked your status. A developmental support is available for it, but it only supports Python3 for now.
If you use Python3, you can add this feature to your application. Please read instructions on nf_concat_support branch.
And other things…
It will be best to Read the Docs instead of expecting every thing from a quick guide :)
TODO List
- Add notification concatenation support.
Notification concatenation is what facebook does when you read a notification like Bob and 18 others commented on your blogpost.
This will require non-anonymous activity stream field.
I’ve to either remove the anonymous notification support or find another way to implement this feature.
work in progress!
Convert Function based views to Class Based views.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-notify-x2-0.5.0.tar.gz
.
File metadata
- Download URL: django-notify-x2-0.5.0.tar.gz
- Upload date:
- Size: 36.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bd95a8755246deed93dbbd7f37eb5b9e56f5b08d2bb990ba6b273ceb9c3e010 |
|
MD5 | e171fcd282ab5e21bd16b675211b26a5 |
|
BLAKE2b-256 | 3053c5805bebace1156c5b7c6f358cc7b07b3d43557557f1c54c7803e3b11252 |