添加修改页面

pull/6/head
ibuler 10 years ago
parent f951471f1d
commit 49dcdf3be0

@ -12,4 +12,5 @@ urlpatterns = patterns('juser.views',
(r'^group_list/$', 'group_list'), (r'^group_list/$', 'group_list'),
(r'^user_detail/$', 'user_detail'), (r'^user_detail/$', 'user_detail'),
(r'^user_del/$', 'user_del'), (r'^user_del/$', 'user_del'),
(r'^user_edit/$', 'user_edit'),
) )

@ -187,6 +187,27 @@ def user_del(request):
return HttpResponseRedirect('/juser/user_list/', locals()) return HttpResponseRedirect('/juser/user_list/', locals())
def user_edit(request):
if request.method == 'GET':
username = request.GET.get('username', None)
if not username:
return HttpResponseRedirect('/')
user = User.objects.get(username=username)
username = user.username
password = user.password
ssh_key_pwd1 = user.ssh_key_pwd1
name = user.name
all_group = UserGroup.objects.all()
groups = user.user_group.all()
groups_str = ' '.join([group.name for group in groups])
user_role = {'SU': u'超级管理员', 'GA': u'组管理员', 'CU': u'普通用户'}
role_post = user.role
ssh_pwd = user.ssh_pwd
email = user.email
return render_to_response('juser/user_add.html', locals())
def db_add_user(**kwargs): def db_add_user(**kwargs):
groups_post = kwargs.pop('groups') groups_post = kwargs.pop('groups')
user = User(**kwargs) user = User(**kwargs)

@ -1,6 +1,6 @@
<div class="footer fixed"> <div class="footer fixed">
<div class="pull-right"> <div class="pull-right">
Version <strong>2.2.0</strong> GPL. Version <strong>1.2.0</strong> GPL.
</div> </div>
<div> <div>
<strong>Copyright</strong> Jumpserver.org Organization &copy; 2014-2015 <strong>Copyright</strong> Jumpserver.org Organization &copy; 2014-2015

@ -59,7 +59,7 @@
<td class="text-center">{{ user.email }}</td> <td class="text-center">{{ user.email }}</td>
<td class="text-center">{{ user.is_active|bool2str }}</td> <td class="text-center">{{ user.is_active|bool2str }}</td>
<td class="text-center"> <td class="text-center">
<a href="../user_detail/?username={{ user.username }}/" class="iframe btn btn-xs btn-primary">详情</a> <a href="../user_detail/?username={{ user.username }}" class="iframe btn btn-xs btn-primary">详情</a>
<a href="../user_edit/?username={{ user.username }}" class="btn btn-xs btn-info">编辑</a> <a href="../user_edit/?username={{ user.username }}" class="btn btn-xs btn-info">编辑</a>
<a href="../user_del/?username={{ user.username }}" class="btn btn-xs btn-danger">删除</a> <a href="../user_del/?username={{ user.username }}" class="btn btn-xs btn-danger">删除</a>
</td> </td>

Loading…
Cancel
Save