diff options
author | nishanth | 2010-02-25 19:39:02 +0530 |
---|---|---|
committer | nishanth | 2010-02-25 19:39:02 +0530 |
commit | a3b252cc9dff4c51d784da17c3077d1e09b4134c (patch) | |
tree | 2445b3c56ca3ad128bd798816d7f6906612171f2 | |
parent | b68318888488e439549562d7f8bf89bc5d83b502 (diff) | |
download | pytask-a3b252cc9dff4c51d784da17c3077d1e09b4134c.tar.gz pytask-a3b252cc9dff4c51d784da17c3077d1e09b4134c.tar.bz2 pytask-a3b252cc9dff4c51d784da17c3077d1e09b4134c.zip |
added browse_notifications functionality .
-rw-r--r-- | taskapp/views/user.py | 18 | ||||
-rw-r--r-- | templates/user/browse_notifications.html | 9 | ||||
-rw-r--r-- | urls.py | 2 |
3 files changed, 29 insertions, 0 deletions
diff --git a/taskapp/views/user.py b/taskapp/views/user.py index fc431cb..5dc686d 100644 --- a/taskapp/views/user.py +++ b/taskapp/views/user.py @@ -153,3 +153,21 @@ def process_request(request, rid, reply): 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 --git a/templates/user/browse_notifications.html b/templates/user/browse_notifications.html new file mode 100644 index 0000000..c4b538e --- /dev/null +++ b/templates/user/browse_notifications.html @@ -0,0 +1,9 @@ +{% extends 'base.html' %} +{% block content %} + {% for notification in notifications %} + <a href="/user/notifications/nid={{notification.pos}}"> + {% if not notification.is_read %} <b> {% endif %} + {{notification.sub}} + {% if not notification.is_read %} </b> {% endif %}</a><br /> + {% endfor %} +{% endblock %} @@ -48,5 +48,7 @@ urlpatterns = patterns('', (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), ) |