diff --git a/notifications/templatetags/notifications_tags.py b/notifications/templatetags/notifications_tags.py
index b0cade6..c5a3f9d 100644
--- a/notifications/templatetags/notifications_tags.py
+++ b/notifications/templatetags/notifications_tags.py
@@ -52,7 +52,9 @@ def register_notify_callbacks(badge_class='live_notify_badge', # pylint: disabl
refresh_period=15,
callbacks='',
api_name='list',
- fetch=5):
+ fetch=5,
+ nonce=None
+ ):
refresh_period = int(refresh_period) * 1000
if api_name == 'list':
@@ -79,7 +81,10 @@ def register_notify_callbacks(badge_class='live_notify_badge', # pylint: disabl
fetch_count=fetch
)
- script = ""
diff --git a/notifications/tests/templates/test_live.html b/notifications/tests/templates/test_live.html
index c8c92c5..eb66c1c 100644
--- a/notifications/tests/templates/test_live.html
+++ b/notifications/tests/templates/test_live.html
@@ -2,7 +2,7 @@
-{% register_notify_callbacks callbacks='fill_notification_list,fill_notification_badge' fetch=20 refresh_period=5 %}
+{% register_notify_callbacks callbacks='fill_notification_list,fill_notification_badge' fetch=20 refresh_period=5 nonce='{{nonce}}' %}
There are this many notifications pending: {% live_notify_badge %}
diff --git a/notifications/tests/tests.py b/notifications/tests/tests.py
index b9a8796..e6a07ae 100644
--- a/notifications/tests/tests.py
+++ b/notifications/tests/tests.py
@@ -436,7 +436,7 @@ class NotificationTestPages(TestCase):
request = factory.get('/notification/live_updater')
request.user = self.to_user
- render(request, 'notifications/test_tags.html', {'request': request})
+ render(request, 'notifications/test_tags.html', {'request': request, 'nonce': 'nonce-T5esDNXMnDe5lKMQ6ZzTUw=='})
# TODO: Add more tests to check what is being output.