diff --git a/juser/urls.py b/juser/urls.py index 326f2df7e..a1d36fcbe 100644 --- a/juser/urls.py +++ b/juser/urls.py @@ -10,4 +10,5 @@ urlpatterns = patterns('juser.views', (r'^user_list/$', 'user_list'), (r'^group_add/$', 'group_add'), (r'^group_list/$', 'group_list'), + (r"^user_detail/$", 'user_detail'), ) diff --git a/juser/views.py b/juser/views.py index 236cf68a7..95aa07822 100644 --- a/juser/views.py +++ b/juser/views.py @@ -11,6 +11,7 @@ import ldap from ldap import modlist from Crypto.PublicKey import RSA import crypt +from django.http import HttpResponseRedirect from django.shortcuts import render_to_response from django.core.exceptions import ObjectDoesNotExist @@ -169,6 +170,14 @@ def user_list(request): return render_to_response('juser/user_list.html', locals()) +def user_detail(request): + username = request.GET.get('username', None) + if not username: + return HttpResponseRedirect('/') + user = User.objects.get(username=username) + return render_to_response('juser/user_detail.html', locals(), context_instance=RequestContext(request)) + + def db_add_user(**kwargs): groups_post = kwargs.pop('groups') user = User(**kwargs) diff --git a/templates/juser/user_detail.html b/templates/juser/user_detail.html new file mode 100644 index 000000000..0186a2ae8 --- /dev/null +++ b/templates/juser/user_detail.html @@ -0,0 +1,71 @@ +{% load mytags %} + + + {% include 'link_css.html' %} + + + + + +
+
+

{{ user.name }} 用户详情

+
+
+ 添加 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
用户详情
ID{{ user.id }}
username{{ user.username }}
姓名{{ user.name }}
角色{{ user.id|get_role }}
属组{{ user.id|get_role }}
Email{{ user.email }}
激活{{ user.is_active|bool2str }}
添加时间{{ user.joined }}
最后登录{{ user.last_login }}
+
+
+ + \ No newline at end of file diff --git a/templates/juser/user_list.html b/templates/juser/user_list.html index ce3063aca..50749ab9b 100644 --- a/templates/juser/user_list.html +++ b/templates/juser/user_list.html @@ -59,7 +59,7 @@ {{ user.email }} {{ user.is_active|bool2str }} - 详情 + 详情 编辑 删除