taskapp/utilities/user.py
author nishanth
Wed, 03 Mar 2010 04:45:38 +0530
changeset 186 c083ebb6f8d7
parent 144 581ad20b8c39
permissions -rw-r--r--
finished the phase-2 successfully. added all the learnmore templates. hav to look for bugs if any.

"""
A collection of utility functions for user.
"""

def get_user(user):
    """ get the no of unread requests and notifications and add them as properties for user.
    """

    unread_notifications = user.notification_sent_to.filter(is_read=False,is_deleted=False)
    unread_requests = user.request_sent_to.filter(is_valid=True,is_replied=False,is_read=False)

    user.unread_notifications = unread_notifications
    user.unread_requests = unread_requests

    return user