当前位置: 首页>>代码示例>>Python>>正文


Python UserSearchForm.get_results方法代码示例

本文整理汇总了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)
开发者ID:hand-code,项目名称:flaskbb,代码行数:32,代码来源:views.py

示例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)
开发者ID:hugleecool,项目名称:flaskbb,代码行数:13,代码来源:views.py

示例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)
开发者ID:centime,项目名称:xss-paper,代码行数:17,代码来源:views.py

示例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)
开发者ID:0xsKu,项目名称:flaskbb,代码行数:18,代码来源:views.py

示例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)
开发者ID:0xsKu,项目名称:flaskbb,代码行数:20,代码来源:views.py


注:本文中的flaskbb.forum.forms.UserSearchForm.get_results方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。