diff --git a/juser/urls.py b/juser/urls.py index 33b5a60d0..3712b517f 100644 --- a/juser/urls.py +++ b/juser/urls.py @@ -12,4 +12,5 @@ urlpatterns = patterns('juser.views', (r'^group_list/$', 'group_list'), (r'^user_detail/$', 'user_detail'), (r'^user_del/$', 'user_del'), + (r'^user_edit/$', 'user_edit'), ) diff --git a/juser/views.py b/juser/views.py index 7e5ae94ec..67d0c8ef2 100644 --- a/juser/views.py +++ b/juser/views.py @@ -187,6 +187,27 @@ def user_del(request): 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): groups_post = kwargs.pop('groups') user = User(**kwargs) diff --git a/templates/footer.html b/templates/footer.html index eeff7cd3c..3574f1c9e 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -1,6 +1,6 @@