From 75d1a5e6a46ded6293b730b57b2a89484a96dd6d Mon Sep 17 00:00:00 2001
From: Nishanth Amuluru
Date: Fri, 7 Jan 2011 12:21:43 +0530
Subject: fixed a typo and browse notifications works fine
---
profile/urls.py | 8 +++++---
profile/views.py | 2 +-
templates/profile/browse_notifications.html | 14 ++++++++++++++
urls.py | 2 +-
4 files changed, 21 insertions(+), 5 deletions(-)
create mode 100644 templates/profile/browse_notifications.html
diff --git a/profile/urls.py b/profile/urls.py
index a577d56..a5e92cd 100644
--- a/profile/urls.py
+++ b/profile/urls.py
@@ -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),
)
diff --git a/profile/views.py b/profile/views.py
index 9192180..386ca49 100755
--- a/profile/views.py
+++ b/profile/views.py
@@ -48,7 +48,7 @@ def browse_notifications(request):
""" 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()
diff --git a/templates/profile/browse_notifications.html b/templates/profile/browse_notifications.html
new file mode 100644
index 0000000..8f53278
--- /dev/null
+++ b/templates/profile/browse_notifications.html
@@ -0,0 +1,14 @@
+{% extends 'base.html' %}
+{% block content %}
+{% if not notifications %}
+You have no notifications.
+{% else %}
+Notifications for you:
+{% for notification in notifications %}
+
+{% if not notification.is_read %} {% endif %}
+{{notification.sub}}
+{% if not notification.is_read %} {% endif %}
+{% endfor %}
+{% endif %}
+{% endblock %}
diff --git a/urls.py b/urls.py
index 1b70ed6..c1f661f 100755
--- a/urls.py
+++ b/urls.py
@@ -22,6 +22,6 @@ urlpatterns = patterns('',
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')),
)
--
cgit