diff options
author | nishanth | 2010-02-28 03:31:40 +0530 |
---|---|---|
committer | nishanth | 2010-02-28 03:31:40 +0530 |
commit | 515dcfae7247c5d14efebe6f09c5ab9dc61e58ab (patch) | |
tree | d2048d96cbb6735313fa9ab4a23ff01f9b08bf7c /taskapp/utilities | |
parent | eb93427d1f7b439258e6d2bd1c89afbd52d34ea2 (diff) | |
download | pytask-515dcfae7247c5d14efebe6f09c5ab9dc61e58ab.tar.gz pytask-515dcfae7247c5d14efebe6f09c5ab9dc61e58ab.tar.bz2 pytask-515dcfae7247c5d14efebe6f09c5ab9dc61e58ab.zip |
now requests in sidebar shows the no.of unread notifications.
Diffstat (limited to 'taskapp/utilities')
-rw-r--r-- | taskapp/utilities/user.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/taskapp/utilities/user.py b/taskapp/utilities/user.py new file mode 100644 index 0000000..bafac0b --- /dev/null +++ b/taskapp/utilities/user.py @@ -0,0 +1,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).count + unread_requests = user.request_sent_to.filter(is_valid=True,is_replied=False).count + + user.unread_notifications = unread_notifications + user.unread_requests = unread_requests + + return user + + |