admins and managers can see full profile of user, including email, address and phone number.
--- 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):
--- 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 @@
<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>
+ {% 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 %}
- {% if profile.city %}
- {{ profile.city }}
- <br>
- {% endif %}
- {% if profile.country %}
- {{ profile.country }}
- {% endif %}
+ {% else %}
{% endif %}
{% endblock %}