Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added never_cache to some views to avoid no-update bug #266

Merged
merged 1 commit into from
Dec 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion notifications/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
''' Django Notifications exemple views '''
''' Django Notifications example views '''
from distutils.version import StrictVersion # pylint: disable=no-name-in-module,import-error

from django import get_version
Expand All @@ -12,6 +12,7 @@
from notifications.models import Notification
from notifications.utils import id2slug, slug2id
from notifications.settings import get_config
from django.views.decorators.cache import never_cache

if StrictVersion(get_version()) >= StrictVersion('1.7.0'):
from django.http import JsonResponse # noqa
Expand Down Expand Up @@ -123,6 +124,7 @@ def delete(request, slug=None):
return redirect('notifications:all')


@never_cache
def live_unread_notification_count(request):
try:
user_is_authenticated = request.user.is_authenticated()
Expand All @@ -140,6 +142,7 @@ def live_unread_notification_count(request):
return JsonResponse(data)


@never_cache
def live_unread_notification_list(request):
''' Return a json with a unread notification list '''
try:
Expand Down Expand Up @@ -187,6 +190,7 @@ def live_unread_notification_list(request):
return JsonResponse(data)


@never_cache
def live_all_notification_list(request):
''' Return a json with a unread notification list '''
try:
Expand Down