【发布时间】:2013-08-30 09:42:12
【问题描述】:
我有这个代码和all() 方法和其他所有方法都适用于此,我已经查看了所有内容,我可以认为paginate() 方法适用于BaseQuery,这也是Query
@app.route('/')
@app.route('/index')
@app.route('/blog')
@app.route('/index/<int:page>')
def index(page = 1):
posts = db.session.query(models.Post).paginate(page, RESULTS_PER_PAGE, False)
return render_template('index.html', title="Home", posts=posts)
但这给了我错误AttributeError: 'Query' object has no attribute 'paginate'
我到处寻找,但找不到任何解决方案。
【问题讨论】:
标签: python pagination flask flask-sqlalchemy