mirror of https://github.com/jumpserver/jumpserver
暂时这样吧
parent
56df1f6963
commit
f3ae7f00a0
|
@ -7,7 +7,6 @@ urlpatterns = patterns('juser.views',
|
|||
# url(r'^$', 'jumpserver.views.home', name='home'),
|
||||
# url(r'^blog/', include('blog.urls')),
|
||||
|
||||
|
||||
(r'^dept_list/$', 'dept_list'),
|
||||
(r'^dept_add/$', 'dept_add'),
|
||||
(r'^dept_del/$', 'dept_del'),
|
||||
|
@ -21,7 +20,7 @@ urlpatterns = patterns('juser.views',
|
|||
(r'^group_del_ajax/$', 'group_del_ajax'),
|
||||
(r'^group_edit/$', 'group_edit'),
|
||||
(r'^user_add/$', 'user_add'),
|
||||
(r'^user_list/(?P<option>\w*)/?$', 'user_list'),
|
||||
(r'^user_list/$', 'user_list'),
|
||||
(r'^user_detail/$', 'user_detail'),
|
||||
(r'^user_del/$', 'user_del'),
|
||||
(r'^user_del_ajax/$', 'user_del_ajax'),
|
||||
|
|
|
@ -527,31 +527,28 @@ def user_add(request):
|
|||
|
||||
|
||||
@require_admin
|
||||
def user_list(request, option=""):
|
||||
def user_list(request):
|
||||
user_role = {'SU': u'瓒呯骇绠$悊鍛', 'GA': u'缁勭鐞嗗憳', 'CU': u'鏅氱敤鎴'}
|
||||
header_title, path1, path2 = '鏌ョ湅鐢ㄦ埛', '鐢ㄦ埛绠$悊', '鐢ㄦ埛鍒楄〃'
|
||||
keyword = request.GET.get('keyword', '')
|
||||
gid = request.GET.get('gid', '')
|
||||
did = request.GET.get('did', '')
|
||||
if option == "search":
|
||||
contact_list = User.objects.filter(Q(username__icontains=keyword) | Q(name__icontains=keyword)).order_by('name')
|
||||
elif option == "group":
|
||||
contact_list = User.objects.all().order_by('name')
|
||||
|
||||
if gid:
|
||||
user_group = UserGroup.objects.filter(id=gid)
|
||||
if user_group:
|
||||
user_group = user_group[0]
|
||||
contact_list = user_group.user_set.all().order_by('name')
|
||||
else:
|
||||
contact_list = []
|
||||
elif option == "dept":
|
||||
contact_list = user_group.user_set.all()
|
||||
|
||||
if did:
|
||||
dept = DEPT.objects.filter(id=did)
|
||||
if dept:
|
||||
dept = dept[0]
|
||||
contact_list = dept.user_set.all().order_by('name')
|
||||
else:
|
||||
contact_list = []
|
||||
else:
|
||||
print option
|
||||
contact_list = User.objects.all().order_by('name')
|
||||
|
||||
if keyword:
|
||||
contact_list = contact_list.filter(Q(username__icontains=keyword) | Q(name__icontains=keyword)).order_by('name')
|
||||
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(contact_list, request)
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
<input type="checkbox" name="selected" value="{{ dept.id }}">
|
||||
</td>
|
||||
<td class="text-center"> {{ dept.name }} </td>
|
||||
<td class="text-center"> {{ dept.id | dept_group_num}} </td>
|
||||
<td class="text-center"> <a href="/juser/">{{ dept.id | dept_group_num}}</a> </td>
|
||||
<td class="text-center"> {{ dept.id | dept_user_num}} </td>
|
||||
<td class="text-center"> {{ dept.id | dept_asset_num}} </td>
|
||||
<td class="text-center"> {{ dept.comment }} </td>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<div class="">
|
||||
<a target="_blank" href="/juser/user_add/" class="btn btn-sm btn-primary "> 娣诲姞鐢ㄦ埛 </a>
|
||||
<a id="del_btn" class="btn btn-sm btn-danger "> 鍒犻櫎鎵閫 </a>
|
||||
<form id="search_form" method="get" action="./search/" class="pull-right mail-search">
|
||||
<form id="search_form" method="get" action="" class="pull-right mail-search">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control input-sm" id="search_input" name="keyword" placeholder="Search">
|
||||
<div class="input-group-btn">
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
<div class="col-sm-6">
|
||||
<div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">
|
||||
<ul class="pagination" style="margin-top: 0; float: right">
|
||||
{% if keyword %}
|
||||
{% if contacts.has_previous %}
|
||||
<li class="paginate_button previous" aria-controls="editable" tabindex="0" >
|
||||
<a href="?keyword={{ keyword }}&page={{ contacts.previous_page_number }}">Previous</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" >
|
||||
<a href="#">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% set href="" %}
|
||||
{% if gid %}
|
||||
{% set href=href+"&gid="+gid %}
|
||||
{% endif %}
|
||||
{% if did %}
|
||||
{% set href=href+"&did="+did %}
|
||||
{% endif %}
|
||||
{% if keyword %}
|
||||
{% set href=href+"&keyword"+keyword %}
|
||||
{% endif %}
|
||||
|
||||
{% ifequal show_first 1 %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page=1{{ href }}" title="绗1椤">1...</a></li>
|
||||
{% endifequal %}
|
||||
{% for page in page_range %}
|
||||
{% ifequal current_page page %}
|
||||
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?page={{ page }}{{ href }}" title="绗瑊{ page }}椤">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ page }}{{ href }}" title="绗瑊{ page }}椤">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
{% ifequal show_end 1 %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ p.num_pages }}{{ href }}" title="绗瑊{ page }}椤">...{{ p.num_pages }}</a></li>
|
||||
{% endifequal %}
|
||||
{% if contacts.has_next %}
|
||||
<li class="paginate_button next" aria-controls="editable" tabindex="0" >
|
||||
<a href="?page={{ contacts.next_page_number }}{{ href }}">Next</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" >
|
||||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
{% if contacts.has_previous %}
|
||||
<li class="paginate_button previous" aria-controls="editable" tabindex="0" >
|
||||
<a href="?page={{ contacts.previous_page_number }}{{ href }}">Previous</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" >
|
||||
<a href="#">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% ifequal show_first 1 %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page=1{{ href }}" title="绗1椤">1...</a></li>
|
||||
{% endifequal %}
|
||||
{% for page in page_range %}
|
||||
{% ifequal current_page page %}
|
||||
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="绗瑊{ page }}椤">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="绗瑊{ page }}椤">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
{% ifequal show_end 1 %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ p.num_pages }}" title="绗瑊{ page }}椤">...{{ p.num_pages }}</a></li>
|
||||
{% endifequal %}
|
||||
{% if contacts.has_next %}
|
||||
<li class="paginate_button next" aria-controls="editable" tabindex="0" >
|
||||
<a href="?page={{ contacts.next_page_number }}">Next</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" >
|
||||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
Loading鈥
Reference in New Issue