profile/templatetags/user_tags.py
author Nishanth Amuluru <nishanth@fossee.in>
Fri, 07 Jan 2011 15:16:29 +0530
changeset 60 696309b5ad59
parent 59 1d04840fdcb8
permissions -rw-r--r--
created a tag and used it in the template

from django import template

register = template.Library()

@register.filter
def notf_dsp(user):

    notf_cnt = user.notification_sent_to.filter(is_deleted=False,
                                                is_read=False).count()

    return u'notifications(%s)'%notf_cnt if notf_cnt else u'notifications'