###What is Django webline Notifications This is a django application to notify user about events. You can simply inform user about all kind of updates.
###Features
- Chose notification status and color
- Thumbnail for notification
- Notification has a URL, can passed in other notifications
- Send group (to list of users) notification
##How to install ###Downloading the package Probably the best way to install is by using PIP:
$ pip install django-webline-notifications
If you want to clone the main repository:
$ git clone https://github.com/alireza-molaee/django-webline-notifications.git
$ cd django-webline-notifications
$ python setup.py install
###install on django now you can add django-simple-notifications to the settings.py file:
INSTALLED_APPS = (
...
'webline_notifications',
'django.contrib.admin',
)
Then run migrations:
$ python manage.py migrate webline-notifications
Then collectstatic:
$ python manage.py collectstatic
now if run server you can see notifications in django admin:
$ python manage.py runserver
##Settings
you can limit archive notification for all user by WEBLINE_NOTIFICATIONS_LIMIT
default is False
it mean (no limit)
for example myproject.settings.py
:
...
WEBLINE_NOTIFICATIONS_LIMIT = 50
...
##Usage to notify every thing you want:
- import Notification
- use Notification.send to send notification
from webline_notification.model import Notification
Notification.send(
...
)
#####send option:
- list of user:
list of user object that you want to receive this notification[obj, obj, ...]
- content:
a small text about event'some one join us'
- icon:
icon css class'fa-info'
- color:
color hex id'#c3c3c3'
- link:
you notification can have a url to where reason of event'http://www.google.com/'
(optional)
you can use default color in Notification Notification.COLOR_DANGER
you can filter notification by color in django admin if you use default color
#####defult colors:
- COLOR_WARNING
- COLOR_DANGER
- COLOR_INFO
- COLOR_SUCCESS
- COLOR_PRIMARY
- COLOR_GRAY
- COLOR_BLACK
#####example:
from webline_notifications.models import Notification
from django.contrib.auth.models import User
user = User.objects.get(pk=1)
Notification.send(
[user],
'foo',
'fa-info',
Notification.COLOR_DANGER,
url='http://www.google.com/'
)
##TODO
- add test for models
- add template tags to use any template
- add view to change see status
- add test for view
- add default settings
- font files
- default notification count to show
- max of notification can be archived
- handle events by AJAX