Skip to content

Commit

Permalink
Merge pull request #130 from ikkebr/patch-1
Browse files Browse the repository at this point in the history
Django 1.9 template tag compatibility
  • Loading branch information
yangyubo committed Apr 16, 2016
2 parents 81c1f87 + 345dd56 commit 74ff1bf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions notifications/templatetags/notifications_tags.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.template import Library
from django.utils.html import format_html

register = Library()

Expand Down Expand Up @@ -51,7 +52,7 @@ def register_notify_callbacks(badge_id='live_notify_badge',
for callback in callbacks.split(','):
script += "register_notifier("+callback+");"
script += "</script>"
return script
return format_html(script)


@register.simple_tag(takes_context=True)
Expand All @@ -63,13 +64,13 @@ def live_notify_badge(context, badge_id='live_notify_badge', classes=""):
html = "<span id='{badge_id}' class='{classes}'>{unread}</span>".format(
badge_id=badge_id, classes=classes, unread=user.notifications.unread().count()
)
return html
return format_html(html)


@register.simple_tag
def live_notify_list(list_id='live_notify_list', classes=""):
html = "<ul id='{list_id}' class='{classes}'></ul>".format(list_id=list_id, classes=classes)
return html
return format_html(html)


def user_context(context):
Expand Down

0 comments on commit 74ff1bf

Please sign in to comment.