taskapp/utilities/user.py
branchbuildout
changeset 227 3c8f3b0e5b00
parent 214 679c7e237052
child 228 81994e525e69
equal deleted inserted replaced
214:679c7e237052 227:3c8f3b0e5b00
     1 """
       
     2 A collection of utility functions for user.
       
     3 """
       
     4 
       
     5 def get_user(user):
       
     6     """ get the no of unread requests and notifications and add them as properties for user.
       
     7     """
       
     8 
       
     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,is_read=False)
       
    11 
       
    12     user.unread_notifications = unread_notifications
       
    13     user.unread_requests = unread_requests
       
    14 
       
    15     return user
       
    16 
       
    17