在我使用 flask-migrate 和 Alembic 的烧瓶应用程序中,我得到了这个 URL“/user/1?sort=ascmonkey=< flask_sqlalchemy.Pagination+object+at+0x7f6a8077ea10 >”,而这部分是额外的 < flask_sqlalchemy.Pagination+object +at+0x7f6a8077ea10 > 它是从哪里来的,我怎样才能摆脱它?谢谢
查看.py:
@layout.route('/user/<int:page>', methods = ['GET', 'POST'])
def user(page=1, sort='normal'):
user = g.user
#condition to sort base on ascending
if request.args.get('sort') =='asc':
sortBy = 'asc'
monkey = Users.query.order_by(Users.name.asc()).paginate(page, MONKEYS_PAGE)
MONKEYS_PAGE)
return render_template('Users.html',
user = user,
title ='Home',
monkey = monkey,
sortBy = sortBy
)
用户.html
<div class="text-right sortby">
<span>Sort by</span>
<a href="{{ url_for('layout.user', page = '1', sort = 'asc', monkey = monkey) }}" class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-sort-by-alphabet"></span>
name
</a>
<a href="{{ url_for('layout.user', page = '1', sort = 'friendnum', monkey = monkey) }}" class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-link"></span>
number of friends
</a>
<a href="{{ url_for('layout.user', page = '1', sort = 'bf', monkey = monkey) }}" class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-link"></span>
name of best friends
</a>
</div>