diff options
author | anoop | 2010-03-08 16:17:41 +0530 |
---|---|---|
committer | anoop | 2010-03-08 16:17:41 +0530 |
commit | 898d718b758ed53505993971c4d38f8be98e2819 (patch) | |
tree | 52bec734f6e791ad5f100cca5cb6ca57d465f21c | |
parent | 3c9428393694176095ac7b1a76ec5a3c86103527 (diff) | |
download | pytask-898d718b758ed53505993971c4d38f8be98e2819.tar.gz pytask-898d718b758ed53505993971c4d38f8be98e2819.tar.bz2 pytask-898d718b758ed53505993971c4d38f8be98e2819.zip |
admins and managers can see full profile of user, including email, address and phone number.
-rw-r--r-- | taskapp/views/user.py | 6 | ||||
-rw-r--r-- | templates/user/my_profile.html | 36 |
2 files changed, 26 insertions, 16 deletions
diff --git a/taskapp/views/user.py b/taskapp/views/user.py index 4c2022b..1ad0c20 100644 --- a/taskapp/views/user.py +++ b/taskapp/views/user.py @@ -85,16 +85,18 @@ def learn_more(request, what): def view_my_profile(request,uid=None): """ allows the user to view the profiles of users """ user = get_user(request.user) + request_user_profile = request.user.get_profile() + request_user_privilege = True if request_user_profile.rights in ['AD','MG'] else False if uid == None: edit_profile = True profile = Profile.objects.get(user = request.user) - return render_to_response('user/my_profile.html', {'edit_profile':edit_profile,'profile':profile, 'user':user}) + return render_to_response('user/my_profile.html', {'edit_profile':edit_profile,'profile':profile, 'user':user, 'privilege':request_user_privilege}) edit_profile = True if request.user == User.objects.get(pk=uid) else False try: profile = Profile.objects.get(user = User.objects.get(pk=uid)) except Profile.DoesNotExist: raise Http404 - return render_to_response('user/my_profile.html', {'edit_profile':edit_profile,'profile':profile, 'user':user}) + return render_to_response('user/my_profile.html', {'edit_profile':edit_profile,'profile':profile, 'user':user, 'privilege':request_user_privilege}) @login_required def edit_my_profile(request): diff --git a/templates/user/my_profile.html b/templates/user/my_profile.html index 2a397b5..bfb6649 100644 --- a/templates/user/my_profile.html +++ b/templates/user/my_profile.html @@ -18,6 +18,9 @@ <img border="0" height="200" src={{ profile.photo.url }}> </a> {% endif %} + {% if privilege or edit_profile %} + <br><h4>E-Mail</h4><hr>{{ user.email }} + {% endif %} {% if profile.aboutme %} <br><h4>About Me</h4><hr>{{ profile.aboutme }} {% endif %} @@ -33,24 +36,29 @@ {% if profile.foss_comm %} <br><h4>Foss Community</h4><hr>{{ profile.foss_comm }} {% endif %} - {% if profile.phonenum %} - <br><h4>Phone Number</h4><hr>{{ profile.phonenum }} + {% if privilege or edit_profile %} + {% if profile.phonenum %} + <br><h4>Phone Number</h4><hr>{{ profile.phonenum }} + {% endif %} {% endif %} {% if profile.homepage %} <br><h4>Homepage</h4><hr>{{ profile.homepage }} {% endif %} - {% if profile.street or profile.city or profile.country %} - <br><h4>Address</h4><hr> - {% if profile.street %} - {{ profile.street }} - <br> - {% endif %} - {% if profile.city %} - {{ profile.city }} - <br> - {% endif %} - {% if profile.country %} - {{ profile.country }} + {% if privilege or edit_profile %} + {% if profile.street or profile.city or profile.country %} + <br><h4>Address</h4><hr> + {% if profile.street %} + {{ profile.street }} + <br> + {% endif %} + {% if profile.city %} + {{ profile.city }} + <br> + {% endif %} + {% if profile.country %} + {{ profile.country }} + {% endif %} {% endif %} + {% else %} {% endif %} {% endblock %} |