python学习
This commit is contained in:
@@ -1,15 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from flask import Blueprint
|
||||
from common.libs.Helper import ops_render
|
||||
from flask import Blueprint,request,redirect
|
||||
from common.libs.Helper import ops_render,iPagination
|
||||
from common.models.User import User
|
||||
route_account = Blueprint( 'account_page',__name__ )
|
||||
|
||||
from application import app,db
|
||||
@route_account.route( "/index" )
|
||||
def index():
|
||||
resp_data={}
|
||||
list = User.query.order_by(User.uid.desc()).all()
|
||||
resp_data['list']=list
|
||||
return ops_render( "account/index.html" ,resp_data)
|
||||
resp_data = {}
|
||||
req = request.values
|
||||
page = int(req['p']) if ('p' in req and req['p']) else 1
|
||||
query = User.query
|
||||
|
||||
page_params = {
|
||||
'total': query.count(),
|
||||
'page_size': app.config['PAGE_SIZE'],
|
||||
'page': page,
|
||||
'display': app.config['PAGE_DISPLAY'],
|
||||
'url': '/account/index'
|
||||
}
|
||||
|
||||
pages = iPagination(page_params)
|
||||
offset = (page - 1) * app.config['PAGE_SIZE']
|
||||
limit = app.config['PAGE_SIZE'] * page
|
||||
|
||||
list = query.order_by(User.uid.desc()).all()[offset:limit]
|
||||
|
||||
resp_data['list'] = list
|
||||
resp_data['pages'] = pages
|
||||
return ops_render("account/index.html", resp_data)
|
||||
|
||||
@route_account.route( "/info" )
|
||||
def info():
|
||||
|
||||
Reference in New Issue
Block a user