# HG changeset patch # User anoop # Date 1268045261 -19800 # Node ID ba839dd7c7d77c2b0ee4404794f40f1dc83ca27b # Parent 2de52334fe6cb1ed562d6158242b9e4130a8c508 admins and managers can see full profile of user, including email, address and phone number. diff -r 2de52334fe6c -r ba839dd7c7d7 taskapp/views/user.py --- a/taskapp/views/user.py Mon Mar 08 13:37:26 2010 +0530 +++ b/taskapp/views/user.py Mon Mar 08 16:17:41 2010 +0530 @@ -85,16 +85,18 @@ 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 -r 2de52334fe6c -r ba839dd7c7d7 templates/user/my_profile.html --- a/templates/user/my_profile.html Mon Mar 08 13:37:26 2010 +0530 +++ b/templates/user/my_profile.html Mon Mar 08 16:17:41 2010 +0530 @@ -18,6 +18,9 @@ {% endif %} + {% if privilege or edit_profile %} +

E-Mail


{{ user.email }} + {% endif %} {% if profile.aboutme %}

About Me


{{ profile.aboutme }} {% endif %} @@ -33,24 +36,29 @@ {% if profile.foss_comm %}

Foss Community


{{ profile.foss_comm }} {% endif %} - {% if profile.phonenum %} -

Phone Number


{{ profile.phonenum }} + {% if privilege or edit_profile %} + {% if profile.phonenum %} +

Phone Number


{{ profile.phonenum }} + {% endif %} {% endif %} {% if profile.homepage %}

Homepage


{{ profile.homepage }} {% endif %} - {% if profile.street or profile.city or profile.country %} -

Address


- {% if profile.street %} - {{ profile.street }} -
+ {% if privilege or edit_profile %} + {% if profile.street or profile.city or profile.country %} +

Address


+ {% if profile.street %} + {{ profile.street }} +
+ {% endif %} + {% if profile.city %} + {{ profile.city }} +
+ {% endif %} + {% if profile.country %} + {{ profile.country }} + {% endif %} {% endif %} - {% if profile.city %} - {{ profile.city }} -
- {% endif %} - {% if profile.country %} - {{ profile.country }} - {% endif %} + {% else %} {% endif %} {% endblock %}