Browse Source

Merge pull request #1947 from jumpserver/dev_user_paging

[Update] 用户列表页,添加分页,搜索
pull/1661/head
老广 6 years ago committed by GitHub
parent
commit
d8afe72d4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      apps/users/api/user.py
  2. 2
      apps/users/templates/users/user_list.html

5
apps/users/api/user.py

@ -9,6 +9,7 @@ from rest_framework import generics
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated
from rest_framework_bulk import BulkModelViewSet
from rest_framework.pagination import LimitOffsetPagination
from ..serializers import UserSerializer, UserPKUpdateSerializer, \
UserUpdateGroupSerializer, ChangeUserPasswordSerializer
@ -28,10 +29,12 @@ __all__ = [
class UserViewSet(IDInFilterMixin, BulkModelViewSet):
filter_fields = ('username', 'email', 'name', 'id')
search_fields = filter_fields
queryset = User.objects.exclude(role="App")
serializer_class = UserSerializer
permission_classes = (IsOrgAdmin,)
filter_fields = ('username', 'email', 'name', 'id')
pagination_class = LimitOffsetPagination
def get_queryset(self):
queryset = super().get_queryset()

2
apps/users/templates/users/user_list.html

@ -95,7 +95,7 @@ function initTable() {
],
op_html: $('#actions').html()
};
table = jumpserver.initDataTable(options);
var table = jumpserver.initServerSideDataTable(options);
return table
}

Loading…
Cancel
Save