taskapp/utilities/user.py
changeset 143 796ff9e279a8
parent 137 e56b95298254
child 144 581ad20b8c39
equal deleted inserted replaced
142:bd65e2c9a7b4 143:796ff9e279a8
     4 
     4 
     5 def get_user(user):
     5 def get_user(user):
     6     """ get the no of unread requests and notifications and add them as properties for user.
     6     """ get the no of unread requests and notifications and add them as properties for user.
     7     """
     7     """
     8 
     8 
     9     unread_notifications = user.notification_sent_to.filter(is_read=False,is_deleted=False).count
     9     unread_notifications = user.notification_sent_to.filter(is_read=False,is_deleted=False)
    10     unread_requests = user.request_sent_to.filter(is_valid=True,is_replied=False).count
    10     unread_requests = user.request_sent_to.filter(is_valid=True,is_replied=False)
    11 
    11 
    12     user.unread_notifications = unread_notifications
    12     user.unread_notifications = unread_notifications
    13     user.unread_requests = unread_requests
    13     user.unread_requests = unread_requests
    14 
    14 
    15     return user
    15     return user