Browse Source

ÐÞ¸Äuser_add.html

pull/6/head
guanghongwei 10 years ago
parent
commit
609b0160f7
  1. 19
      juser/views.py
  2. 20
      templates/juser/user_add.html

19
juser/views.py

@ -56,8 +56,25 @@ def user_list(request):
def user_add(request):
error = ''
msg = ''
user_role = {'SU': 'SuperUser', 'GA': 'GroupAdmin', 'CU': 'CommonUser'}
groups = Group.objects.all()
if request.method == 'POST':
username = request.POST.get('j_username', None)
password = request.POST.get('j_password', None)
name = request.POST.get('j_name', None)
email = request.POST.get('j_email', '')
groups = request.POST.getlist('j_group', None)
role = request.POST.get('j_role', None)
ssh_pwd = request.POST.get('j_ssh_pwd', None)
is_active = request.POST.get('j_is_active', None)
return render_to_response('juser/user_add.html',
{'header_title': u'添加用户 | Add User', 'path1': 'juser', 'path2': 'user_add'})
{'header_title': u'添加用户 | Add User',
'path1': 'juser', 'path2': 'user_add',
'roles': user_role, 'groups': groups})

20
templates/juser/user_add.html

@ -63,8 +63,12 @@
<label for="j_group" class="col-lg-2 control-label">属组<span class="red-fonts">*</span></label>
<div class="col-sm-8">
<select id="j_group" name="j_group" class="form-control m-b" multiple>
<option selected>Test1</option>
<option>Test2</option>
{% for group in groups %}
{% if forloop.first %}
<option value="{{ group.id }}" selected>group.name</option>
{% endif %}
<option value="{{ group.id }}">group.name</option>
{% endfor %}
</select>
</div>
</div>
@ -73,16 +77,20 @@
<label for="j_role" class="col-lg-2 control-label">角色<span class="red-fonts">*</span></label>
<div class="col-sm-8">
<select id="j_role" name="j_role" class="form-control m-b">
<option>Test role</option>
<option selected>Test role</option>
{% for r, role in roles.items %}
<option value="{{ r }}">{{ role }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="j_ldap_pwd" class="col-sm-2 control-label">LDAP密ç <span class="red-fonts">*</span></label>
<label for="j_ldap_pwd" class="col-sm-2 control-label">SSH密ç </label>
<div class="col-sm-8">
<input id="j_ldap_pwd" name="j_ldap_pwd" type="password" placeholder="LDAP Password" class="form-control">
<span class="help-block m-b-none">
如果使用passwordæ–¹å¼ï¼Œè¯¥å¯†ç æ˜¯ç”¨æˆ·åœ¨åŽç«¯æœåŠ¡å™¨çš„密ç 
</span>
</div>
</div>
<div class="hr-line-dashed"></div>
@ -111,6 +119,4 @@
</div>
</div>
</script>
{% endblock %}
Loading…
Cancel
Save