修改bug

pull/6/head
guanghongwei 2015-01-10 15:15:49 +08:00
parent ae227aad77
commit 8b91d5774f
3 changed files with 33 additions and 33 deletions

View File

@ -13,8 +13,8 @@ def group_add(request):
error = '' error = ''
msg = '' msg = ''
if request.method == 'POST': if request.method == 'POST':
group_name = request.POST.get('j_group_name', None) group_name = request.POST.get('group_name', None)
comment = request.POST.get('j_comment', None) comment = request.POST.get('comment', None)
try: try:
if not group_name: if not group_name:
@ -77,15 +77,15 @@ def user_add(request):
user_role = {'SU': u'瓒呯骇绠$悊鍛', 'GA': u'缁勭鐞嗗憳', 'CU': u'鏅氱敤鎴'} user_role = {'SU': u'瓒呯骇绠$悊鍛', 'GA': u'缁勭鐞嗗憳', 'CU': u'鏅氱敤鎴'}
all_group = UserGroup.objects.all() all_group = UserGroup.objects.all()
if request.method == 'POST': if request.method == 'POST':
username = request.POST.get('j_username', None) username = request.POST.get('username', None)
password = request.POST.get('j_password', None) password = request.POST.get('password', None)
name = request.POST.get('j_name', None) name = request.POST.get('name', None)
email = request.POST.get('j_email', '') email = request.POST.get('email', '')
groups = request.POST.getlist('j_group', None) groups = request.POST.getlist('groups', None)
role = request.POST.get('j_role', None) role = request.POST.get('role', None)
ssh_pwd = request.POST.get('j_ssh_pwd', None) ssh_pwd = request.POST.get('ssh_pwd', None)
ssh_key_pwd1 = request.POST.get('j_ssh_key_pwd1', None) ssh_key_pwd1 = request.POST.get('ssh_key_pwd1', None)
is_active = request.POST.get('j_is_active', None) is_active = request.POST.get('is_active', '1')
try: try:
if None in [username, password, ssh_key_pwd1, name, groups, role, is_active]: if None in [username, password, ssh_key_pwd1, name, groups, role, is_active]:

View File

@ -35,16 +35,16 @@
<div class="alert alert-success text-center">{{ msg }}</div> <div class="alert alert-success text-center">{{ msg }}</div>
{% endif %} {% endif %}
<div class="form-group"> <div class="form-group">
<label for="j_group_name" class="col-sm-2 control-label">缁勫悕<span class="red-fonts">*</span></label> <label for="group_name" class="col-sm-2 control-label">缁勫悕<span class="red-fonts">*</span></label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="j_group_name" name="j_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">
</div> </div>
</div> </div>
<div class="hr-line-dashed"></div> <div class="hr-line-dashed"></div>
<div class="form-group"> <div class="form-group">
<label for="j_comment" class="col-sm-2 control-label">澶囨敞</label> <label for="comment" class="col-sm-2 control-label">澶囨敞</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="j_comment" name="j_comment" placeholder="Comment" type="text" class="form-control"> <input id="comment" name="comment" placeholder="Comment" type="text" class="form-control">
</div> </div>
</div> </div>

View File

@ -35,16 +35,16 @@
<div class="alert alert-success text-center">{{ msg }}</div> <div class="alert alert-success text-center">{{ msg }}</div>
{% endif %} {% endif %}
<div class="form-group"> <div class="form-group">
<label for="j_username" class="col-sm-2 control-label">鐢ㄦ埛鍚<span class="red-fonts">*</span></label> <label for="username" class="col-sm-2 control-label">鐢ㄦ埛鍚<span class="red-fonts">*</span></label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="j_username" name="j_username" placeholder="Username" type="text" class="form-control"> <input id="username" name="username" placeholder="Username" type="text" class="form-control">
</div> </div>
</div> </div>
<div class="hr-line-dashed"></div> <div class="hr-line-dashed"></div>
<div class="form-group"> <div class="form-group">
<label for="j_password" class="col-sm-2 control-label">瀵嗙爜<span class="red-fonts">*</span></label> <label for="password" class="col-sm-2 control-label">瀵嗙爜<span class="red-fonts">*</span></label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="j_password" name="j_password" placeholder="Password" type="password" class="form-control"> <input id="password" name="password" placeholder="Password" type="password" class="form-control">
<span class="help-block m-b-none"> <span class="help-block m-b-none">
鐧婚檰web鐨勫瘑鐮 鐧婚檰web鐨勫瘑鐮
</span> </span>
@ -52,9 +52,9 @@
</div> </div>
<div class="hr-line-dashed"></div> <div class="hr-line-dashed"></div>
<div class="form-group"> <div class="form-group">
<label for="j_ssh_key_pwd1" class="col-sm-2 control-label">瀵嗛挜瀵嗙爜<span class="red-fonts">*</span></label> <label for="ssh_key_pwd1" class="col-sm-2 control-label">瀵嗛挜瀵嗙爜<span class="red-fonts">*</span></label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="j_ssh_key_pwd1" name="j_ssh_key_pwd1" placeholder="SSH Key Password" type="password" class="form-control"> <input id="ssh_key_pwd1" name="ssh_key_pwd1" placeholder="SSH Key Password" type="password" class="form-control">
<span class="help-block m-b-none"> <span class="help-block m-b-none">
鐧婚檰 Jumpserver 浣跨敤鐨凷SH瀵嗛挜鐨勫瘑鐮 鐧婚檰 Jumpserver 浣跨敤鐨凷SH瀵嗛挜鐨勫瘑鐮
</span> </span>
@ -62,16 +62,16 @@
</div> </div>
<div class="hr-line-dashed"></div> <div class="hr-line-dashed"></div>
<div class="form-group"> <div class="form-group">
<label for="j_name" class="col-sm-2 control-label">濮撳悕<span class="red-fonts">*</span></label> <label for="name" class="col-sm-2 control-label">濮撳悕<span class="red-fonts">*</span></label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="j_name" name="j_name" placeholder="Name" type="text" class="form-control" > <input id="name" name="name" placeholder="Name" type="text" class="form-control" >
</div> </div>
</div> </div>
<div class="hr-line-dashed"></div> <div class="hr-line-dashed"></div>
<div class="form-group"> <div class="form-group">
<label for="j_group" class="col-lg-2 control-label">灞炵粍<span class="red-fonts">*</span></label> <label for="groups" class="col-lg-2 control-label">灞炵粍<span class="red-fonts">*</span></label>
<div class="col-sm-8"> <div class="col-sm-8">
<select id="j_group" name="j_group" class="form-control m-b" multiple> <select id="groups" name="groups" class="form-control m-b" multiple>
{% for group in all_group %} {% for group in all_group %}
{% if forloop.first %} {% if forloop.first %}
<option value="{{ group.id }}" selected>{{ group.name }}</option> <option value="{{ group.id }}" selected>{{ group.name }}</option>
@ -84,9 +84,9 @@
</div> </div>
<div class="hr-line-dashed"></div> <div class="hr-line-dashed"></div>
<div class="form-group"> <div class="form-group">
<label for="j_role" class="col-lg-2 control-label">瑙掕壊<span class="red-fonts">*</span></label> <label for="role" class="col-lg-2 control-label">瑙掕壊<span class="red-fonts">*</span></label>
<div class="col-sm-8"> <div class="col-sm-8">
<select id="j_role" name="j_role" class="form-control m-b"> <select id="role" name="role" class="form-control m-b">
{% for r, role in roles.items %} {% for r, role in roles.items %}
<option value="{{ r }}">{{ role }}</option> <option value="{{ r }}">{{ role }}</option>
{% endfor %} {% endfor %}
@ -95,9 +95,9 @@
</div> </div>
<div class="hr-line-dashed"></div> <div class="hr-line-dashed"></div>
<div class="form-group"> <div class="form-group">
<label for="j_ssh_pwd" class="col-sm-2 control-label">SSH瀵嗙爜</label> <label for="ssh_pwd" class="col-sm-2 control-label">SSH瀵嗙爜</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="j_ssh_pwd" name="j_ssh_pwd" type="password" placeholder="SSH Password" class="form-control"> <input id="ssh_pwd" name="ssh_pwd" type="password" placeholder="SSH Password" class="form-control">
<span class="help-block m-b-none"> <span class="help-block m-b-none">
濡傛灉浣跨敤password鏂瑰紡璇ュ瘑鐮佹槸鐢ㄦ埛鍦ㄥ悗绔湇鍔″櫒鐨勫瘑鐮 濡傛灉浣跨敤password鏂瑰紡璇ュ瘑鐮佹槸鐢ㄦ埛鍦ㄥ悗绔湇鍔″櫒鐨勫瘑鐮
</span> </span>
@ -105,9 +105,9 @@
</div> </div>
<div class="hr-line-dashed"></div> <div class="hr-line-dashed"></div>
<div class="form-group"> <div class="form-group">
<label for="j_email" class="col-sm-2 control-label">Email</label> <label for="email" class="col-sm-2 control-label">Email</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="j_email" name="j_email" type="email" placeholder="Email" class="form-control"> <input id="email" name="email" type="email" placeholder="Email" class="form-control">
</div> </div>
</div> </div>
<div class="hr-line-dashed"></div> <div class="hr-line-dashed"></div>
@ -115,10 +115,10 @@
<div class="col-sm-8"> <div class="col-sm-8">
<div class="radio i-checks"> <div class="radio i-checks">
<label><input type="radio" value="1" name="j_is_active" checked>鍚敤 </label> <label><input type="radio" value="1" name="is_active" checked>鍚敤 </label>
</div> </div>
<div class="radio i-checks"> <div class="radio i-checks">
<label><input type="radio" value="0" name="j_is_active">绂佺敤 </label> <label><input type="radio" value="0" name="is_active">绂佺敤 </label>
</div> </div>
</div> </div>
</div> </div>