author | nishanth |
Sun, 28 Feb 2010 14:58:11 +0530 | |
changeset 144 | 581ad20b8c39 |
parent 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 |
|
143
796ff9e279a8
now if a user accepts to be a mentor, all his pending reqs will be made invalid.
nishanth
parents:
137
diff
changeset
|
9 |
unread_notifications = user.notification_sent_to.filter(is_read=False,is_deleted=False) |
144
581ad20b8c39
modified get_user method to give only count of unread requests.
nishanth
parents:
143
diff
changeset
|
10 |
unread_requests = user.request_sent_to.filter(is_valid=True,is_replied=False,is_read=False) |
137
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 |