blob: 79dc22f74d5510277ea81afbe57367a0bc32631e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
"""
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)
user.unread_notifications = unread_notifications
user.unread_requests = unread_requests
return user
|