From d2669c2de09c4567c54d338712c0055054831ced Mon Sep 17 00:00:00 2001 From: guanghongwei Date: Sat, 24 Jan 2015 13:34:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9group=20edit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- juser/views.py | 14 ++++++++++---- templates/juser/group_add.html | 6 +++--- templates/juser/user_list.html | 6 +++--- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/juser/views.py b/juser/views.py index 72d7c77bc..0fb10c8df 100644 --- a/juser/views.py +++ b/juser/views.py @@ -192,7 +192,13 @@ def group_edit(request): return render_to_response('juser/group_add.html', locals()) else: - pass + group_id = request.POST.get('id', None) + group_name = request.POST.get('group_name', None) + comment = request.POST.get('comment', '') + group = UserGroup.objects.filter(id=group_id) + group.update(name=group_name, comment=comment) + + return HttpResponseRedirect('/juser/group_list/') def user_list(request): @@ -234,10 +240,10 @@ def user_edit(request): header_title, path1, path2 = '编辑用户 | Edit User', 'juser', 'user_edit' readonly = "readonly" if request.method == 'GET': - username = request.GET.get('username', None) - if not username: + user_id = request.GET.get('id', None) + if not user_id: return HttpResponseRedirect('/') - user = User.objects.get(username=username) + user = User.objects.get(id=user_id) username = user.username password = user.password ssh_key_pwd1 = user.ssh_key_pwd1 diff --git a/templates/juser/group_add.html b/templates/juser/group_add.html index 8de84ea00..6e4fa6559 100644 --- a/templates/juser/group_add.html +++ b/templates/juser/group_add.html @@ -37,20 +37,20 @@
- +
- +
diff --git a/templates/juser/user_list.html b/templates/juser/user_list.html index 8c69ec253..f2c5596c4 100644 --- a/templates/juser/user_list.html +++ b/templates/juser/user_list.html @@ -59,9 +59,9 @@ {{ user.email }} {{ user.is_active|bool2str }} - 详情 - 编辑 - 删除 + 详情 + 编辑 + 删除 {% endfor %}