# HG changeset patch # User Nishanth Amuluru # Date 1294383918 -19800 # Node ID c8c47fcb46f02476e537dfd1e64c3b904b22f5cc # Parent c701e68f8d3579bdfbaa441a4b5be7fa40af78ff created a view for view notification and included the url. made changes accordingly in browse notifications diff -r c701e68f8d35 -r c8c47fcb46f0 profile/urls.py --- a/profile/urls.py Fri Jan 07 12:21:43 2011 +0530 +++ b/profile/urls.py Fri Jan 07 12:35:18 2011 +0530 @@ -1,12 +1,13 @@ from django.conf.urls.defaults import * from pytask.profile.views import view_profile, edit_profile,\ - browse_notifications + browse_notifications, view_notification urlpatterns = patterns('', (r'^view/$', view_profile), (r'^edit/$', edit_profile), (r'^notf/browse/$', browse_notifications), + (r'^notf/view/nid=(\w+)$', view_notification), ) diff -r c701e68f8d35 -r c8c47fcb46f0 profile/views.py --- a/profile/views.py Fri Jan 07 12:21:43 2011 +0530 +++ b/profile/views.py Fri Jan 07 12:35:18 2011 +0530 @@ -57,3 +57,29 @@ } return render_to_response('profile/browse_notifications.html', context) + +@login_required +def view_notification(request, nid): + """ get the notification depending on nid. + Display it. + """ + + user = get_user(request.user) + newest, newer, notification, older, oldest = + get_notification(nid, user) + + if not notification: + raise Http404 + + notification.is_read = True + notification.save() + + context = {'user':user, + 'notification':notification, + 'newest':newest, + 'newer':newer, + 'older':older, + 'oldest':oldest, + } + + return render_to_response('profile/view_notification.html', context) diff -r c701e68f8d35 -r c8c47fcb46f0 templates/profile/browse_notifications.html --- a/templates/profile/browse_notifications.html Fri Jan 07 12:21:43 2011 +0530 +++ b/templates/profile/browse_notifications.html Fri Jan 07 12:35:18 2011 +0530 @@ -5,7 +5,7 @@ {% else %} Notifications for you:
{% for notification in notifications %} - + {% if not notification.is_read %} {% endif %} {{notification.sub}} {% if not notification.is_read %} {% endif %}