Coder Social home page Coder Social logo

aaronbloomfield / django-nyt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from django-wiki/django-nyt

0.0 3.0 0.0 445 KB

Notification system for Django with batteries included: Email digests, user settings, JSON API

License: Apache License 2.0

Makefile 1.67% Python 77.40% CSS 6.34% HTML 14.59%

django-nyt's Introduction

django-nyt

https://travis-ci.org/django-wiki/django-nyt.png?branch=master Documentation Status http://codecov.io/github/django-wiki/django-nyt/coverage.svg?branch=master

Concept

django-nyt is a notification framework for Django, it does this:

from django_nyt.utils import notify

EVENT_KEY = "my_key"
notify(_("OMG! Something happened"), EVENT_KEY)

All users subscribing to "my_key" will have a notification created in their stack when notify() is called.

If you have emails enabled, subscribers receive a summary of notifications at an interval of their choice.

Data can be accessed easily from Django models or from the included JSON views.

Channels (django-channels)

Starting from django-nyt 1.0, support for the upcoming channels has been added together with Django 1.9 and 1.10 support.

In order to install the prerelease, use an extra flag for pip:

pip install django-nyt --pre

Docs

http://django-nyt.readthedocs.io/en/latest/

Why should you do this?

Users need a cleverly sifted stream of events that's highly customizable as well. By using django-nyt, your users can subscribe to global events or specific events pertaining specific objects.

Instead of inventing your own notification system, use this and you won't have to design your own models, and you will have a nice guide that goes through the various steps of implementing notifications for your project.

Let's try to summarize the reasons you want to be using django-nyt:

  • Simple API: call notify() where-ever you want.
  • CLI for sending emails (as cron job, daemon or Celery task)
  • Support for django-channels and Web Sockets (optional, fallback for JSON-based polling)
  • Basic JavaScript / HTML example code
  • Multi-lingual
  • Individual subscription settings for each type of event, for instance: - Event type A spawns instant email notifications, but Event B only gets emailed weekly.
  • Customizable intervals for which users can receive notifications
  • Optional URL for action target for each notification
  • Avoid clutter: Notifications don't get repeated, instead a counter is incremented.

This project exists with django.contrib.messages in mind, to serve a simple, best-practice, scalable solution for notifications. There are loads of other notification apps for Django, some focus on integration of specific communication protocols

What do you need to do?

django-nyt does everything it can to meet as many needs as possible and have sane defaults.

But you need to do a lot! Firstly, you need to write some JavaScript that will fetch the latest notifications and display them in some area of the screen. Upon clicking that icon, the latest notifications are displayed, and clicking an individual notification will redirect the user through a page that marks the notification as read.

Something like this:

Javascript drop-down

JavaScript drop-down: Some examples are provided in the docs, but there is no real easy way to place this nifty little thing at the top of your site, you're going to have to work it out on your own.

Other items for your TODO list:

  • Provide your users with options to customize their subscriptions and notification preferences. Create your own Form inheriting from django_nyt.forms.SettingsForm.
  • Customize contents of notification emails by overwriting templates in django_nyt/emails/notification_email_message.txt and django_nyt/emails/notification_email_subject.txt.
  • Make the mail notification daemon script run either constantly python manage.py notifymail --daemon or with some interval by invoking python manage.py notifymail --cron as a cronjob. You can also call it from a Celery task or similar with call_command('notifymail', cron=True).

Development / demo project

In your Git fork, run pip install -r requirements.txt to install the requirements.

Install pre-commit hooks to verify your commits:

pip install pre-commit
pre-commit install

The folder test-project/ contains a pre-configured django project and an SQlite database. Login for django admin is admin:admin:

cd test-project
python manage.py runserver

After this, navigate to http://localhost:8000

Community

Please visit #django-wiki on irc.freenode.net as many django-wiki users are also familiar with django-nyt which previously lived inside django-wiki.

django-nyt's People

Contributors

aaronbloomfield avatar atombrella avatar benjaoming avatar destos avatar duvholt avatar hiasen avatar holoduke avatar jluttine avatar kimond avatar rsalmaso avatar spookylukey avatar timeyyy avatar tonioo avatar valberg avatar ztomaz avatar

Watchers

 avatar  avatar  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.