fixed a typo and browse notifications works fine
authorNishanth Amuluru <nishanth@fossee.in>
Fri, 07 Jan 2011 12:21:43 +0530
changeset 37 c701e68f8d35
parent 36 5cd56898033c
child 38 c8c47fcb46f0
fixed a typo and browse notifications works fine
profile/urls.py
profile/views.py
templates/profile/browse_notifications.html
urls.py
--- a/profile/urls.py	Fri Jan 07 12:16:50 2011 +0530
+++ b/profile/urls.py	Fri Jan 07 12:21:43 2011 +0530
@@ -1,10 +1,12 @@
 from django.conf.urls.defaults import *
 
-from pytask.profile.views import view_profile, edit_profile
+from pytask.profile.views import view_profile, edit_profile,\
+                                 browse_notifications
 
 urlpatterns = patterns('',
 
-            (r'view', view_profile),
-            (r'edit', edit_profile),
+            (r'^view/$', view_profile),
+            (r'^edit/$', edit_profile),
+            (r'^notf/browse/$', browse_notifications),
 )
 
--- a/profile/views.py	Fri Jan 07 12:16:50 2011 +0530
+++ b/profile/views.py	Fri Jan 07 12:21:43 2011 +0530
@@ -48,7 +48,7 @@
     """ get the list of notifications that are not deleted and display in
     datetime order."""
 
-    user = get_user(request.user)
+    user = request.user
 
     active_notifications = user.notification_sent_to.filter(is_deleted=False).order_by('sent_date').reverse()
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/profile/browse_notifications.html	Fri Jan 07 12:21:43 2011 +0530
@@ -0,0 +1,14 @@
+{% extends 'base.html' %}
+{% block content %}
+{% if not notifications %}
+You have no notifications.
+{% else %}
+Notifications for you: <br />
+{% for notification in notifications %}
+<a href="/user/notifications/nid={{notification.uniq_key}}">
+{% if not notification.is_read %} <b> {% endif %}
+{{notification.sub}}
+{% if not notification.is_read %} </b> {% endif %}</a><br />
+{% endfor %}
+{% endif %}
+{% endblock %}
--- a/urls.py	Fri Jan 07 12:16:50 2011 +0530
+++ b/urls.py	Fri Jan 07 12:21:43 2011 +0530
@@ -22,6 +22,6 @@
     url(r'^accounts/register/$', register,
         {'form_class': CustomRegistrationForm},
         name='registration_register'),
-    (r'^accounts/profile/', include('pytask.profile.urls')),
     (r'^accounts/', include('registration.urls')),
+    (r'^profile/', include('pytask.profile.urls')),
 )