Example #1
0
def users():
    params = request.args if request.method == 'GET' else request.form
    _query = params.get('query', '')
    _total = models.User.fetch_count(_query)
    _page_size = params.get('pageSize', gconf.PAGE_SIZE)
    _page_num = params.get('pageNum', 1)

    _pageList, _offset = PageList.create_pagelist(_page_num, _page_size, _total)
    # 获取所有用户
    _users = models.User.fetch_all(_query, _offset, _pageList.pageSize)
    _pageList.set_contents(_users)
    
    # 返回用户列表页面
    return render_template('users.html', query=_query, pageList=_pageList)
Example #2
0
def users():
    params = request.args if request.method == 'GET' else request.form
    _query = params.get('query', '')
    _total = models.User.fetch_count(_query)
    _page_size = params.get('pageSize', gconf.PAGE_SIZE)
    _page_num = params.get('pageNum', 1)

    _pageList, _offset = PageList.create_pagelist(_page_num, _page_size,
                                                  _total)
    # 获取所有用户
    _users = models.User.fetch_all(_query, _offset, _pageList.pageSize)
    _pageList.set_contents(_users)

    # 返回用户列表页面
    return render_template('users.html', query=_query, pageList=_pageList)
Example #3
0
def assets():
    params = request.args if request.method == 'GET' else request.form
    _query = params.get('query', '')

    _total = models.Asset.query_count(_query)
    _machine_rooms = models.MachineRoom.get_machine_rooms()
    
    # 分页信息
    _page_num = params.get('pageNum', 1)
    _page_size = params.get('pageSize', gconf.PAGE_SIZE)

    _pageList, _offset = PageList.create_pagelist(_page_num, _page_size, _total)
    
    _assets = models.Asset.query_all(_query, _offset, _pageList.pageSize)
    _pageList.set_contents(_assets)
    print _pageList
    return render_template('assets.html', machineRooms=_machine_rooms, query=_query, pageList=_pageList) 
Example #4
0
def assets():
    params = request.args if request.method == 'GET' else request.form
    _query = params.get('query', '')

    _total = models.Asset.query_count(_query)
    _machine_rooms = models.MachineRoom.get_machine_rooms()

    # 分页信息
    _page_num = params.get('pageNum', 1)
    _page_size = params.get('pageSize', gconf.PAGE_SIZE)

    _pageList, _offset = PageList.create_pagelist(_page_num, _page_size,
                                                  _total)

    _assets = models.Asset.query_all(_query, _offset, _pageList.pageSize)
    _pageList.set_contents(_assets)
    print _pageList
    return render_template('assets.html',
                           machineRooms=_machine_rooms,
                           query=_query,
                           pageList=_pageList)