修改group edit

pull/6/head
guanghongwei 2015-01-24 13:34:36 +08:00
parent 08d42f1c2c
commit d2669c2de0
3 changed files with 16 additions and 10 deletions

View File

@ -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

View File

@ -37,20 +37,20 @@
<div class="form-group hidden">
<label for="group_id" class="col-sm-2 control-label">ID<span class="red-fonts">*</span></label>
<div class="col-sm-8">
<input id="group_name" name="group_name" placeholder="Group name" type="text" class="form-control">
<input id="group_id" name="group_id" placeholder="Group name" type="text" class="form-control" value="{{ group_id }}">
</div>
</div>
<div class="form-group">
<label for="group_name" class="col-sm-2 control-label">缁勫悕<span class="red-fonts">*</span></label>
<div class="col-sm-8">
<input id="group_name" name="group_name" placeholder="Group name" type="text" class="form-control">
<input id="group_name" name="group_name" placeholder="Group name" type="text" class="form-control" value="{{ group_name }}">
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="comment" class="col-sm-2 control-label">澶囨敞</label>
<div class="col-sm-8">
<input id="comment" name="comment" placeholder="Comment" type="text" class="form-control">
<input id="comment" name="comment" placeholder="Comment" type="text" class="form-control" value="{{ comment }}">
</div>
</div>

View File

@ -59,9 +59,9 @@
<td class="text-center">{{ user.email }}</td>
<td class="text-center">{{ user.is_active|bool2str }}</td>
<td class="text-center">
<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_del/?username={{ user.username }}" class="btn btn-xs btn-danger">鍒犻櫎</a>
<a href="../user_detail/?id={{ user.id }}" class="iframe btn btn-xs btn-primary">璇︽儏</a>
<a href="../user_edit/?id={{ user.id }}" class="btn btn-xs btn-info">缂栬緫</a>
<a href="../user_del/?id={{ user.id }}" class="btn btn-xs btn-danger">鍒犻櫎</a>
</td>
</tr>
{% endfor %}