修改user_edit和 group_edit

pull/6/head
guanghongwei 2015-01-24 13:20:52 +08:00
parent b836a28e77
commit 08d42f1c2c
6 changed files with 89 additions and 4 deletions

View File

@ -13,4 +13,7 @@ urlpatterns = patterns('juser.views',
(r'^user_detail/$', 'user_detail'),
(r'^user_del/$', 'user_del'),
(r'^user_edit/$', 'user_edit'),
(r'^group_detail/$', 'group_detail'),
(r'^group_del/$', 'group_del'),
(r'^group_edit/$', 'group_edit'),
)

View File

@ -163,6 +163,38 @@ def group_list(request):
return render_to_response('juser/group_list.html', locals())
def group_detail(request):
group_id = request.GET.get('id', None)
if not group_id:
return HttpResponseRedirect('/')
group = UserGroup.objects.get(id=group_id)
return render_to_response('juser/group_detail.html', locals())
def group_del(request):
group_id = request.GET.get('id', None)
if not group_id:
return HttpResponseRedirect('/')
group = UserGroup.objects.get(id=group_id)
group.delete()
return HttpResponseRedirect('/juser/group_list/', locals())
def group_edit(request):
error = ''
msg = ''
header_title, path1, path2 = '淇敼灞炵粍 | Edit Group', 'juser', 'group_edit'
if request.method == 'GET':
group_id = request.GET.get('id', None)
group = UserGroup.objects.get(id=group_id)
group_name = group.name
comment = group.comment
return render_to_response('juser/group_add.html', locals())
else:
pass
def user_list(request):
user_role = {'SU': u'瓒呯骇绠$悊鍛', 'GA': u'缁勭鐞嗗憳', 'CU': u'鏅氱敤鎴'}
header_title, path1, path2 = '鏌ョ湅鐢ㄦ埛 | Show User', 'juser', 'user_list'
@ -200,7 +232,7 @@ def user_del(request):
def user_edit(request):
header_title, path1, path2 = '缂栬緫鐢ㄦ埛 | Edit User', 'juser', 'user_edit'
hidden = "hidden"
readonly = "readonly"
if request.method == 'GET':
username = request.GET.get('username', None)
if not username:

View File

@ -34,6 +34,12 @@
{% if msg %}
<div class="alert alert-success text-center">{{ msg }}</div>
{% endif %}
<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">
</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">

View File

@ -0,0 +1,44 @@
{% load mytags %}
<html>
<head>
{% include 'link_css.html' %}
<style type="text/css">
body
{
background: #FFFFFF;
}
</style>
</head>
<body>
<div class="row">
<div class="contact-box">
<h2 class="text-center">{{ group.name }} 灞炵粍璇︽儏</h2>
<div class="ibox-content">
<table class="table table-striped table-bordered table-hover " id="editable" >
<thead>
<tr>
<th class="text-center">灞炵粍</th>
<th class="text-center">璇︽儏</th>
</tr>
</thead>
<tbody>
<tr class="gradeX">
<td class="text-center">ID</td>
<td class="text-center">{{ group.id }}</td>
</tr>
<tr class="gradeX">
<td class="text-center">缁勫悕</td>
<td class="text-center">{{ group.name }}</td>
</tr>
<tr class="gradeX">
<td class="text-center">澶囨敞</td>
<td class="text-center">{{ group_comment }}</td>
</tr>
</table>
</div>
</div>
</body>
</html>

View File

@ -30,7 +30,7 @@
<div class="ibox-content">
<div class="">
<a target="_blank" href="/juser/user_add/" class="btn btn-sm btn-primary "> 娣诲姞 </a>
<a target="_blank" href="/juser/group_add/" class="btn btn-sm btn-primary "> 娣诲姞 </a>
</div>
<table class="table table-striped table-bordered table-hover " id="editable" >

View File

@ -35,10 +35,10 @@
{% if msg %}
<div class="alert alert-success text-center">{{ msg }}</div>
{% endif %}
<div class="form-group {{ hidden }}">
<div class="form-group">
<label for="username" class="col-sm-2 control-label">鐢ㄦ埛鍚<span class="red-fonts">*</span></label>
<div class="col-sm-8">
<input id="username" name="username" placeholder="Username" type="text" class="form-control" value={{ username }}>
<input id="username" name="username" placeholder="Username" type="text" class="form-control" value={{ username }} {{ readonly }}>
</div>
</div>
<div class="hr-line-dashed"></div>