# HG changeset patch # User nishanth # Date 1267106942 -19800 # Node ID e2903a92b5e81de0a3e7735011f68075b248579f # Parent 2275886511dfad9f0846e1a065559c2a099c4542 added browse_notifications functionality . diff -r 2275886511df -r e2903a92b5e8 taskapp/views/user.py --- 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) diff -r 2275886511df -r e2903a92b5e8 templates/user/browse_notifications.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/user/browse_notifications.html Thu Feb 25 19:39:02 2010 +0530 @@ -0,0 +1,9 @@ +{% extends 'base.html' %} +{% block content %} + {% for notification in notifications %} + + {% if not notification.is_read %} {% endif %} + {{notification.sub}} + {% if not notification.is_read %} {% endif %}
+ {% endfor %} +{% endblock %} diff -r 2275886511df -r e2903a92b5e8 urls.py --- a/urls.py Thu Feb 25 18:49:17 2010 +0530 +++ b/urls.py Thu Feb 25 19:39:02 2010 +0530 @@ -48,5 +48,7 @@ (r'^user/requests/$', userViews.browse_requests), (r'^user/requests/rid=(\d+)/$', userViews.view_request), (r'^user/requests/rid=(\d+)/(\w+)/$', userViews.process_request), + + (r'^user/notifications/$', userViews.browse_notifications), )