taskapp/views/user.py
changeset 101 e2903a92b5e8
parent 100 2275886511df
child 103 3a4c8fccb9f3
--- a/taskapp/views/user.py	Thu Feb 25 18:49:17 2010 +0530
+++ b/taskapp/views/user.py	Thu Feb 25 19:39:02 2010 +0530
@@ -153,3 +153,21 @@
         return show_msg("Your reply has been processed", browse_request_url, "view other requests")
     else:
         return show_msg("You are not authorised to do this", browse_request_url, "view other requests")
+
+@login_required
+def browse_notifications(request):
+    """ get the list of notifications that are not deleted and display in datetime order.
+    """
+
+    user = request.user
+
+    active_notifications = user.notification_to.filter(deleted=False).order_by('sent_date').reverse()
+    for pos, notification in enumerate(reversed(active_notifications)):
+        notification.pos = pos
+
+    context = {
+        'user':user,
+        'notifications':active_notifications,
+    }
+
+    return render_to_response('user/browse_notifications.html', context)