From 6eb1848c6faca98c7bff9b11c780954b1a077552 Mon Sep 17 00:00:00 2001 From: xiez Date: Sun, 15 Apr 2012 23:33:22 +0800 Subject: [PATCH] Modify user info page --- templates/userinfo.html | 19 ++++++++----------- views.py | 16 ++++++---------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/templates/userinfo.html b/templates/userinfo.html index 44046b622c..b5fc6c7e1b 100644 --- a/templates/userinfo.html +++ b/templates/userinfo.html @@ -10,7 +10,7 @@ {% block right_panel %} -

用户信息

+

{{ email }}的计算机:

@@ -18,25 +18,22 @@ - {% for userid, list in user_dict.items %} + {% for username, roles in user_dict.items %} - {% if list|last %} - + {% if username %} + {% else %} {% endif %} - {% if list|first %} - - {% else %} - - {% endif %} - - {% if list|first %} + {% if roles %} + {% else %} + {% endif %} + {% endfor %}
计算机名状态
{{ list|last }}{{ username }}未知{{ list|first }}{{ roles }} 已验证 未验证
diff --git a/views.py b/views.py index 207c64d8bf..78446a92fe 100644 --- a/views.py +++ b/views.py @@ -298,22 +298,18 @@ def user_info(request, email): userid_list = get_binding_userids(email) for userid in userid_list: - user_list = [] - try: - roles = ccnet_rpc.get_user(userid).props.role_list - except: - roles = '' - user_list.append(roles) try: peernames = ccnet_rpc.get_peernames_by_userid(userid) + for peername in peernames.split('\n'): + roles = ccnet_rpc.get_user(userid).props.role_list + user_dict[peername] = roles except: - peernames = '' - user_list.append(peernames) - user_dict[userid] = user_list - + pass + return render_to_response( 'userinfo.html', { 'user_dict': user_dict, + 'email': email }, context_instance=RequestContext(request))