taskapp/views/user.py
changeset 101 e2903a92b5e8
parent 100 2275886511df
child 103 3a4c8fccb9f3
equal deleted inserted replaced
100:2275886511df 101:e2903a92b5e8
   151         reply_to_request(req_obj, reply, user)
   151         reply_to_request(req_obj, reply, user)
   152         
   152         
   153         return show_msg("Your reply has been processed", browse_request_url, "view other requests")
   153         return show_msg("Your reply has been processed", browse_request_url, "view other requests")
   154     else:
   154     else:
   155         return show_msg("You are not authorised to do this", browse_request_url, "view other requests")
   155         return show_msg("You are not authorised to do this", browse_request_url, "view other requests")
       
   156 
       
   157 @login_required
       
   158 def browse_notifications(request):
       
   159     """ get the list of notifications that are not deleted and display in datetime order.
       
   160     """
       
   161 
       
   162     user = request.user
       
   163 
       
   164     active_notifications = user.notification_to.filter(deleted=False).order_by('sent_date').reverse()
       
   165     for pos, notification in enumerate(reversed(active_notifications)):
       
   166         notification.pos = pos
       
   167 
       
   168     context = {
       
   169         'user':user,
       
   170         'notifications':active_notifications,
       
   171     }
       
   172 
       
   173     return render_to_response('user/browse_notifications.html', context)