Giter VIP home page Giter VIP logo

django-notifs's Introduction

Documentation Maintainability Test Coverage Pypi Style guide

Modular Notifications (InApp, Email, SMS, CustomBackend etc) for Django

django-notifs

django-notifs is a modular notifications app for Django that basically allows you to notify users about events that occur in your application E.g

  • Your profile has been verified
  • User xxxx sent you a message

It also allows you to deliver these notifications to any destination you want to with custom delivery channels.

It also supports asynchronous notification with several pluggable delivery backends (e.g Celery, RQ etc)

Examples?

A tutorial on how to build a Realtime Chat application with Vue, django-notifs, RabbitMQ and uWSGI

The Repository for the chat app (Chatire) is also available on github

Documentation

https://django-notifs.readthedocs.io

django-notifs's People

Contributors

curti-s avatar danidee10 avatar natureshadow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

django-notifs's Issues

Support for DjangoChannels

Hey,
it would be awesome if this library could also offer the possibility to user django channels and redis for websocket connections.

Is there any chance for support?

Create delivery backends

Delivery backends are backends responsible for running the channel's code (E.g Celery).

The eventual goal is to support multiple backends

  • Synchronous
  • Celery
  • rq
  • django-channels etc

The primary goal for this issue is to create a base backend and decouple the Celery code into a new "Celery backend"

Redis Option

This is more or less a feature request, we already use Redis and am thinking we will be better off using redis than RabitQM.

Can you advise on how we can achieve this?

URLs/Views missing / docs outdated?

As pe rthe installation docs:

Include the urls in urls.py:

urlpatterns = [
    ...
    path('notifications/', include('notifications.urls', namespace='notifications')),
    ...
]

As it stands, I cannot find any URL patterns or views in django-notifs.

My guess is that the docs are outdated?

AppRegistryNotReady: Models aren't loaded yet

Hi, Daniel!

I had got a following error when I manage.py makemigrations a django project with django-notifs installed:

Traceback (most recent call last):
  File "manage.py", line 14, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 341, in execute
    django.setup()
  File "/usr/lib/python2.7/dist-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/lib/python2.7/dist-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/usr/lib/python2.7/dist-packages/django/apps/config.py", line 199, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/usr/local/lib/python2.7/dist-packages/notifications/models.py", line 23, in <module>
    class Notification(models.Model):
  File "/usr/local/lib/python2.7/dist-packages/notifications/models.py", line 54, in Notification
    User = get_user_model()
  File "/usr/lib/python2.7/dist-packages/django/contrib/auth/__init__.py", line 163, in get_user_model
    return django_apps.get_model(settings.AUTH_USER_MODEL)
  File "/usr/lib/python2.7/dist-packages/django/apps/registry.py", line 192, in get_model
    self.check_models_ready()
  File "/usr/lib/python2.7/dist-packages/django/apps/registry.py", line 131, in check_models_ready
    raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.

I use Python 2.7.13, Django 1.10.7, django-notifs 2.6.1.

Is this a good idea not to use a django/contrib get_user_model(), but use directly settings.AUTH_USER_MODEL as mentioned here?

Thank you!

Improve JSONField

We should take advantage of Postgres' native JSONField and enable it for Postgres users.

Other databases should fallback to the current Implementation.

Add schedule functionality

Users should be able to schedule a notification

i.e Send this notification in 10 minutes. This can be used to send tentative notifications where a notification is only sent based on a user actions (i.e viewing a message directly or reminders to take an action)

Simplify delivery backend arguments

We shouldn't expose the provider_class argument for delivery backends.

The delivery backend should be able to get the provider_class with it's the provider_name.

Questionnable usefulness of context processor

The context processor in notifivcations.notifications.notifications, besides being named interestingly, is of questionnable use in my opinion.

As the current user is injected into template context by default, except if a project diverts from the stnadard behaviour of having RequestContext, injecting one attribute of the user again is not really useful. Templates should simply use user.notifications.

Typo in docs

direct in main page)

from notifications.channel import BaseNotificationChannel

fix to

from notifications.channels import BaseNotificationChannel

Handle missing provider dependencies properly

Currently, if a provider's dependency is missing, it fails silently and django-notifs says it's not a valid provider

This is misleading because it might be a valid provider with missing dependencies.

We should display a better error message that highlights the missing dependency and guides the user on the package to install.

Suggest to loosen the dependency on tweepy

Hi, your project django-notifs(commit id: f349fdf) requires "tweepy==4.1.0" in its dependency. After analyzing the source code, we found that the following versions of tweepy can also be suitable, i.e., tweepy 4.0.0, 4.0.1, 4.2.0, 4.3.0, 4.4.0, since all functions that you directly (7 APIs: tweepy.errors.Forbidden.init, tweepy.errors.TooManyRequests.init, tweepy.auth.OAuthHandler.set_access_token, tweepy.api.API.init, tweepy.auth.OAuthHandler.init, tweepy.errors.Forbidden.init, tweepy.errors.TooManyRequests.init) or indirectly (propagate to -1 tweepy's internal APIs and 3 outsider APIs) used from the package have not been changed in these versions, thus not affecting your usage.

Therefore, we believe that it is quite safe to loose your dependency on tweepy from "tweepy==4.1.0" to "tweepy>=4.0.0,<=4.4.0". This will improve the applicability of django-notifs and reduce the possibility of any further dependency conflict with other projects.

May I pull a request to further loosen the dependency on tweepy?

By the way, could you please tell us whether such an automatic tool for dependency analysis may be potentially helpful for maintaining dependencies easier during your development?

NotificationError

Hello,good job you've done here, i am finding this app really useful.
I kinda need to use the NotificationError class somewhere but can't seem to find where it's defined.
Can you please help on this.
Thank you.

Add Retry functionality

This should be configurable (at least via settings). But per class configuration is desirable

Add a license

I believe that you'd want this to be an open source project which people can be able to contribute and improve it. Please add a license. โœŒ๏ธ

Authentication Issue

It seems that the notification endpoints assume that request are authenticated causing an exception when request is made by anonymous user:

Internal Server Error: /api/v1/notifications/
Traceback (most recent call last):
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\views\generic\base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\views\generic\base.py", line 97, in dispatch
return handler(request, *args, **kwargs)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\views\generic\list.py", line 142, in get
self.object_list = self.get_queryset()
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\notifications\views.py", line 30, in get_queryset
return queryset.filter(recipient=self.request.user)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\db\models\query.py", line 892, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\db\models\query.py", line 910, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\db\models\sql\query.py", line 1290, in add_q
clause, _ = self._add_q(q_object, self.used_aliases)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\db\models\sql\query.py", line 1318, in _add_q
split_subq=split_subq, simple_col=simple_col,
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\db\models\sql\query.py", line 1224, in build_filter
self.check_related_objects(join_info.final_field, value, join_info.opts)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\db\models\sql\query.py", line 1086, in check_related_objects
for v in value:
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\utils\functional.py", line 257, in inner
return func(self._wrapped, *args)
TypeError: 'AnonymousUser' object is not iterable

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.