本文整理汇总了Python中flaskbb.forum.forms.UserSearchForm.get_results方法的典型用法代码示例。如果您正苦于以下问题:Python UserSearchForm.get_results方法的具体用法?Python UserSearchForm.get_results怎么用?Python UserSearchForm.get_results使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flaskbb.forum.forms.UserSearchForm
的用法示例。
在下文中一共展示了UserSearchForm.get_results方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: memberlist
# 需要导入模块: from flaskbb.forum.forms import UserSearchForm [as 别名]
# 或者: from flaskbb.forum.forms.UserSearchForm import get_results [as 别名]
def memberlist():
page = request.args.get('page', 1, type=int)
sort_by = request.args.get('sort_by', 'reg_date')
order_by = request.args.get('order_by', 'asc')
sort_obj = None
order_func = None
if order_by == 'asc':
order_func = asc
else:
order_func = desc
if sort_by == 'reg_date':
sort_obj = User.id
elif sort_by == 'post_count':
sort_obj = User.post_count
else:
sort_obj = User.username
search_form = UserSearchForm()
if search_form.validate():
users = search_form.get_results().\
paginate(page, flaskbb_config['USERS_PER_PAGE'], False)
return render_template("forum/memberlist.html", users=users,
search_form=search_form)
else:
users = User.query.order_by(order_func(sort_obj)).\
paginate(page, flaskbb_config['USERS_PER_PAGE'], False)
return render_template("forum/memberlist.html", users=users,
search_form=search_form)
示例2: users
# 需要导入模块: from flaskbb.forum.forms import UserSearchForm [as 别名]
# 或者: from flaskbb.forum.forms.UserSearchForm import get_results [as 别名]
def users():
page = request.args.get("page", 1, type=int)
search_form = UserSearchForm()
if search_form.validate():
users = search_form.get_results().paginate(page, current_app.config['USERS_PER_PAGE'], False)
return render_template("admin/users.html", users=users, search_form=search_form)
else:
users = User.query. \
paginate(page, current_app.config['USERS_PER_PAGE'], False)
return render_template("admin/users.html", users=users, search_form=search_form)
示例3: memberlist
# 需要导入模块: from flaskbb.forum.forms import UserSearchForm [as 别名]
# 或者: from flaskbb.forum.forms.UserSearchForm import get_results [as 别名]
def memberlist():
page = request.args.get('page', 1, type=int)
search_form = UserSearchForm()
if search_form.validate():
users = search_form.get_results().\
paginate(page, flaskbb_config['USERS_PER_PAGE'], False)
return render_template("forum/memberlist.html", users=users,
search_form=search_form)
else:
users = User.query.\
paginate(page, flaskbb_config['USERS_PER_PAGE'], False)
return render_template("forum/memberlist.html", users=users,
search_form=search_form)
示例4: users
# 需要导入模块: from flaskbb.forum.forms import UserSearchForm [as 别名]
# 或者: from flaskbb.forum.forms.UserSearchForm import get_results [as 别名]
def users():
page = request.args.get("page", 1, type=int)
search_form = UserSearchForm()
if search_form.validate():
users = search_form.get_results().\
paginate(page, flaskbb_config['USERS_PER_PAGE'], False)
return render_template("management/users.html", users=users,
search_form=search_form)
users = User.query. \
order_by(User.id.asc()).\
paginate(page, flaskbb_config['USERS_PER_PAGE'], False)
return render_template("management/users.html", users=users,
search_form=search_form)
示例5: banned_users
# 需要导入模块: from flaskbb.forum.forms import UserSearchForm [as 别名]
# 或者: from flaskbb.forum.forms.UserSearchForm import get_results [as 别名]
def banned_users():
page = request.args.get("page", 1, type=int)
search_form = UserSearchForm()
users = User.query.filter(
Group.banned == True,
Group.id == User.primary_group_id
).paginate(page, flaskbb_config['USERS_PER_PAGE'], False)
if search_form.validate():
users = search_form.get_results().\
paginate(page, flaskbb_config['USERS_PER_PAGE'], False)
return render_template("management/banned_users.html", users=users,
search_form=search_form)
return render_template("management/banned_users.html", users=users,
search_form=search_form)