author | nishanth |
Sun, 28 Feb 2010 03:31:40 +0530 | |
changeset 137 | e56b95298254 |
child 143 | 796ff9e279a8 |
permissions | -rw-r--r-- |
137
e56b95298254
now requests in sidebar shows the no.of unread notifications.
nishanth
parents:
diff
changeset
|
1 |
""" |
e56b95298254
now requests in sidebar shows the no.of unread notifications.
nishanth
parents:
diff
changeset
|
2 |
A collection of utility functions for user. |
e56b95298254
now requests in sidebar shows the no.of unread notifications.
nishanth
parents:
diff
changeset
|
3 |
""" |
e56b95298254
now requests in sidebar shows the no.of unread notifications.
nishanth
parents:
diff
changeset
|
4 |
|
e56b95298254
now requests in sidebar shows the no.of unread notifications.
nishanth
parents:
diff
changeset
|
5 |
def get_user(user): |
e56b95298254
now requests in sidebar shows the no.of unread notifications.
nishanth
parents:
diff
changeset
|
6 |
""" get the no of unread requests and notifications and add them as properties for user. |
e56b95298254
now requests in sidebar shows the no.of unread notifications.
nishanth
parents:
diff
changeset
|
7 |
""" |
e56b95298254
now requests in sidebar shows the no.of unread notifications.
nishanth
parents:
diff
changeset
|
8 |
|
e56b95298254
now requests in sidebar shows the no.of unread notifications.
nishanth
parents:
diff
changeset
|
9 |
unread_notifications = user.notification_sent_to.filter(is_read=False,is_deleted=False).count |
e56b95298254
now requests in sidebar shows the no.of unread notifications.
nishanth
parents:
diff
changeset
|
10 |
unread_requests = user.request_sent_to.filter(is_valid=True,is_replied=False).count |
e56b95298254
now requests in sidebar shows the no.of unread notifications.
nishanth
parents:
diff
changeset
|
11 |
|
e56b95298254
now requests in sidebar shows the no.of unread notifications.
nishanth
parents:
diff
changeset
|
12 |
user.unread_notifications = unread_notifications |
e56b95298254
now requests in sidebar shows the no.of unread notifications.
nishanth
parents:
diff
changeset
|
13 |
user.unread_requests = unread_requests |
e56b95298254
now requests in sidebar shows the no.of unread notifications.
nishanth
parents:
diff
changeset
|
14 |
|
e56b95298254
now requests in sidebar shows the no.of unread notifications.
nishanth
parents:
diff
changeset
|
15 |
return user |
e56b95298254
now requests in sidebar shows the no.of unread notifications.
nishanth
parents:
diff
changeset
|
16 |
|
e56b95298254
now requests in sidebar shows the no.of unread notifications.
nishanth
parents:
diff
changeset
|
17 |