diff --git a/flashcards/models.py b/flashcards/models.py index 193af29..70fb7b1 100644 --- a/flashcards/models.py +++ b/flashcards/models.py @@ -88,7 +88,7 @@ class User(AbstractUser, SimpleEmailConfirmationUserMixin): import flashcards.notifications flashcards.notifications.notify_score_change(flashcard) - flashcards.notifications.deck_card_score_change(flashcard) + flashcards.notifications.notify_pull(flashcard) def unpull(self, flashcard): if not self.is_in_section(flashcard.section): diff --git a/flashcards/notifications.py b/flashcards/notifications.py index 322e7dd..2601a55 100644 --- a/flashcards/notifications.py +++ b/flashcards/notifications.py @@ -20,16 +20,9 @@ def notify_new_card(flashcard): message = RedisMessage(ws_message) redis_publisher.publish_message(message) -# def tell all clients the score changed - # you added a card - # -def deck_card_score_change(flashcard): +def notify_pull(flashcard): redis_publisher = RedisPublisher(facility='deck/%d' % flashcard.section_id, users=[SELF]) ws_message = JSONRenderer().render( {'event_type': 'pull_card', 'flashcard': serializers.FlashcardSerializer(flashcard).data}) message = RedisMessage(ws_message) - redis_publisher.publish_message(message) - - - -# def hiding stuff \ No newline at end of file + redis_publisher.publish_message(message) \ No newline at end of file diff --git a/flashy/settings.py b/flashy/settings.py index 556921e..92d23ca 100644 --- a/flashy/settings.py +++ b/flashy/settings.py @@ -27,8 +27,10 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', 'ws4redis', + 'rest_framework_swagger', 'rest_framework', + 'django_extensions', ] WEBSOCKET_URL = '/ws/' @@ -151,3 +153,4 @@ CACHES = { SWAGGER_SETTINGS = { 'doc_expansion': 'list' } + diff --git a/requirements.txt b/requirements.txt index d5fef4a..240382f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,3 +12,4 @@ django-simple-email-confirmation coverage django-rest-swagger pytz +django-extensions