Merge branches 'guanghongwei' and 'wangyong' of gitcafe.com:ibuler/jumpserver into guanghongwei

Conflicts:
	jumpserver/urls.py
	jumpserver/views.py
pull/6/head
guanghongwei 2015-04-09 11:32:32 +08:00
commit 419ee2660a
5 changed files with 18 additions and 46 deletions

View File

@ -420,7 +420,7 @@ def list_idc(request):
if keyword:
posts = IDC.objects.filter(Q(name__contains=keyword) | Q(comment__contains=keyword))
else:
posts = IDC.objects.all().order_by('id')
posts = IDC.objects.exclude(name='ALL').order_by('id')
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
return render_to_response('jasset/idc_list.html', locals(), context_instance=RequestContext(request))

View File

@ -1,12 +1,9 @@
from django.conf.urls import patterns, include, url
from views import index
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'jumpserver.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
(r'^$', index),
(r'^$', 'jumpserver.views.index'),
(r'^api/user/$', 'jumpserver.api.api_user'),
(r'^skin_config/$', 'jumpserver.views.skin_config'),
(r'^install/$', 'jumpserver.views.install'),

View File

@ -65,15 +65,11 @@ def index_cu(request):
return render_to_response('index_cu.html', locals(), context_instance=RequestContext(request))
@require_admin
def admin_index(request):
user_id = request.session.get('user_id', '')
user = User.objects.get(id=user_id)
dept = user.dept
dept_name = user.dept.name
users = User.objects.filter(dept=dept)
hosts = Asset.objects.filter(dept=dept)
online = Log.objects.filter(dept_name=dept_name, is_finished=0)
@require_login
def index(request):
users = User.objects.all()
hosts = Asset.objects.all()
online = Log.objects.filter(is_finished=0)
online_host = online.values('host').distinct()
online_user = online.values('user').distinct()
active_users = users.filter(is_active=1)
@ -196,9 +192,6 @@ def index(request):
return render_to_response('index.html', locals(), context_instance=RequestContext(request))
def skin_config(request):
return render_to_response('skin_config.html')

View File

@ -184,40 +184,22 @@ $('#assetForm').validator({
msg: {required: "必须填写!"}
},
"j_group": {
rule: "checked",
tip: "选择业务组",
rule: "required",
tip: "选择主机组",
ok: "",
msg: {checked: "至少选择一个组"}
},
"j_usergroup": {
rule: "checked",
tip: "选择用户组",
"j_idc": {
rule: "required",
tip: "选择IDC",
ok: "",
msg: {checked: "至少选择一个组"}
msg: {checked: "必须填写!"}
},
"j_user": {
rule: "required(type_m)",
tip: "普通用户名",
"j_dept": {
rule: "required",
tip: "选择部门",
ok: "",
msg: {required: "请填写用户名"}
},
"j_password": {
rule: "required(type_m);length[6~16]",
tip: "密码6-16位",
ok: "",
msg: {required: "6-16位"}
},
"j_root": {
rule: "required(type_m)",
tip: "超管用户名",
ok: "",
msg: {required: "请填写用户名"}
},
"j_passwd": {
rule: "required(type_m);length[6~16]",
tip: "密码6-16位",
ok: "",
msg: {required: "6-16位"}
msg: {checked: "至少选择一个部门"}
}
},
valid: function(form) {

View File

@ -34,7 +34,7 @@
<div class="alert alert-success text-center">{{ smg }}</div>
{% endif %}
<form id="assetForm" method="post" class="form-horizontal">
<div class="form-group"><label class="col-sm-2 control-label"> IDC名 </label>
<div class="form-group"><label class="col-sm-2 control-label"> IDC名 <span class="red-fonts">*</span></label>
<div class="col-sm-8"><input type="text" value="{{ j_idc.name }}" placeholder="北京联通" name="j_idc" class="form-control"></div>
</div>