本文整理匯總了Python中flaskbb.forum.forms.UserSearchForm類的典型用法代碼示例。如果您正苦於以下問題:Python UserSearchForm類的具體用法?Python UserSearchForm怎麽用?Python UserSearchForm使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了UserSearchForm類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: memberlist
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
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
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
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
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)