Only logged in users can view user profile.
authoranoop
Mon, 15 Feb 2010 15:14:27 +0530
changeset 39 476613c3ab0a
parent 38 7910ff503036
child 40 43853e376bb8
Only logged in users can view user profile.
taskapp/views/user.py
--- a/taskapp/views/user.py	Fri Feb 12 23:30:57 2010 +0530
+++ b/taskapp/views/user.py	Mon Feb 15 15:14:27 2010 +0530
@@ -6,6 +6,8 @@
 from django.contrib.auth import login, logout, authenticate
 from django.contrib.auth.models import User
 from pytask.taskapp.models import Profile
+from django.contrib.auth.decorators import login_required
+
 
 def show_msg(message, redirect_url=None, url_desc=None):
     """ simply redirect to homepage """
@@ -99,6 +101,7 @@
     logout(request)
     return show_msg('You have logged off successfully!!!')
 
+@login_required
 def view_my_profile(request,uid):
     """ allows the user to view the profiles of users """
     edit_profile = True if request.user == User.objects.get(pk=uid) else False