update noftifications

needed a new way to populate the noticetype table because of signal
deprecation
pull/1/head
eric 2016-07-22 18:44:54 -04:00
parent 5b4badb7e6
commit ff38f063d0
5 changed files with 17 additions and 4 deletions

View File

@ -3,9 +3,10 @@ def is_preview(request):
return {'jquery_home': settings.JQUERY_HOME, 'jquery_ui_home': settings.JQUERY_UI_HOME, 'is_preview': settings.IS_PREVIEW, 'show_google_analytics': settings.SHOW_GOOGLE_ANALYTICS}
def count_unseen(request):
from notification.models import Notice, NoticeManager
if request.user.is_anonymous():
count = 0
else:
from notification.models import Notice
count = Notice.objects.unseen_count_for(request.user)
return {'unseen_count': count}

View File

@ -0,0 +1 @@
default_app_config = 'regluit.core.apps.CoreConfig'

11
core/apps.py Normal file
View File

@ -0,0 +1,11 @@
from django.apps import AppConfig
from django.db.models.signals import post_migrate
from regluit.core.signals import create_notice_types
class CoreConfig(AppConfig):
name = 'regluit.core'
verbose_name = 'regluit core'
def ready(self):
post_migrate.connect(create_notice_types, sender=self)

View File

@ -61,7 +61,7 @@ post_save.connect(create_api_key, sender=User)
# create notification types (using django-notification) -- tie to syncdb
def create_notice_types(app, created_models, verbosity, **kwargs):
def create_notice_types( **kwargs):
notification.create_notice_type("comment_on_commented", _("Comment on Commented Work"), _("A comment has been received on a book that you've commented on."))
notification.create_notice_type("wishlist_comment", _("Book List Comment"), _("A comment has been received on one of your books."), default = 1)
notification.create_notice_type("wishlist_official_comment", _("Book List Comment"), _("The author or publisher, or and Unglue.it staffer, has commented on one of your faves."))
@ -101,7 +101,7 @@ signals.post_syncdb.connect(create_notice_types, sender=notification)
# define the notifications and tie them to corresponding signals
from django.contrib.comments.signals import comment_was_posted
from django_comments.signals import comment_was_posted
def notify_comment(comment, request, **kwargs):
logger.info('comment %s notifying' % comment.pk)

View File

@ -35,7 +35,7 @@ django-maintenancemode==0.10
django-mptt==0.7.4
django-nose-selenium==0.7.3
#django-notification==0.2
git+git://github.com/eshellman/django-notification.git@8bb7afbbb07e8cad74bc1cf17e0ac6fc117c0497
git+git://github.com/eshellman/django-notification.git@412c7a03a327195a1017c2be92c8e2caabc880b6
django-registration==2.1.1
django-selectable==0.9.0
django-smtp-ssl==1.0