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


Python User.get_users方法代码示例

本文整理汇总了Python中models.user.User.get_users方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_users方法的具体用法?Python User.get_users怎么用?Python User.get_users使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.user.User的用法示例。


在下文中一共展示了User.get_users方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: user_add

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_users [as 别名]
def user_add():
    values = json.loads(request.form['params'])
    try:
        user = User.add_user(values)
        return jsonify(id=id, users=User.get_users())
    except Exception as ex:
        return jsonify(error=str(ex))
开发者ID:joegillon,项目名称:allocat,代码行数:9,代码来源:users.py

示例2: usr_drop

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_users [as 别名]
def usr_drop():
    user_id = json.loads(request.args['id'])
    success = User.delete_user(user_id)
    if not success:
        msg = 'Record not deleted for unknown reason. Contact admin.'
        return jsonify(error=msg)
    users = User.get_users()
    return jsonify(users=users)
开发者ID:joegillon,项目名称:allocat,代码行数:10,代码来源:users.py

示例3: user_mgt

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_users [as 别名]
def user_mgt():
    users = User.get_users()
    roles = User.get_roles()
    return render_template(
        'users.html',
        title='allocat users',
        users=users,
        roles=roles
    )
开发者ID:joegillon,项目名称:allocat,代码行数:11,代码来源:users.py

示例4: user_update

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_users [as 别名]
def user_update():
    values = json.loads(request.form['params'])
    try:
        numrows = User.update_user(values)
        if numrows != 1:
            msg = 'Record not updated for unknown reason. Contact admin.'
            return jsonify(error=msg)
        return jsonify(id=values['id'], users=User.get_users())
    except Exception as ex:
        return jsonify(error=str(ex))
开发者ID:joegillon,项目名称:allocat,代码行数:12,代码来源:users.py

示例5: user_add

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_users [as 别名]
def user_add():
    values = json.loads(request.form['params'])
    dao = Dao(stateful=True)
    try:
        user_id = User.add_user(dao, values)
        if 'precinct_ids' in values:
            ids = [int(pid) for pid in values['precinct_ids'].split(',') if pid]
            User.add_precinct_ids(dao, user_id, ids)
        users = User.get_users()
        return jsonify(users=users)
    except Exception as ex:
        return jsonify(error=str(ex))
    finally:
        dao.close()
开发者ID:joegillon,项目名称:bluestreets_app,代码行数:16,代码来源:users.py

示例6: user_drop

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_users [as 别名]
def user_drop():
    user_id = json.loads(request.args['id'])
    dao = Dao(stateful=True)
    try:
        success = User.delete_user(dao, user_id)
        if not success:
            msg = 'Record not deleted for unknown reason. Contact admin.'
            return jsonify(error=msg)
        users = User.get_users()
        return jsonify(users=users)
    except Exception as ex:
        return jsonify(error=str(ex))
    finally:
        dao.close()
开发者ID:joegillon,项目名称:bluestreets_app,代码行数:16,代码来源:users.py

示例7: user_mgt

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_users [as 别名]
def user_mgt():
    from models.precinct import Precinct

    dao = Dao(stateful=True)
    jurisdictions = Precinct.get_jurisdictions(dao)
    precincts = Precinct.get_all(dao)
    roles = User.get_roles(dao)
    users = User.get_users(dao)
    precinct_admins = User.get_precinct_admins(dao)
    dao.close()
    return render_template(
        'users.html',
        title='Bluestreets users',
        jurisdictions=jurisdictions,
        precincts=[precinct.serialize() for precinct in precincts],
        roles=roles,
        users=users,
        precinct_admins=precinct_admins
    )
开发者ID:joegillon,项目名称:bluestreets_app,代码行数:21,代码来源:users.py

示例8: user_update

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_users [as 别名]
def user_update():
    values = json.loads(request.form['params'])
    dao = Dao(stateful=True)
    try:
        if 'fromPrecinctAdmin' in values:
            numrows = User.delete_precinct_admins_for_user(values['id'])
        numrows = User.update_user(dao, values)
        if numrows != 1:
            msg = 'Record not updated for unknown reason. Contact admin.'
            return jsonify(error=msg)
        if 'precinct_ids' in values:
            ids = [int(pid) for pid in values['precinct_ids'].split(',') if pid]
            del_ids = list(set(values['prev_precincts']) - set(ids))
            add_ids = list(set(ids) - set(values['prev_precincts']))
            User.delete_precinct_admins_for_user(dao, values['id'], del_ids)
            User.add_precinct_ids(dao, values['id'], add_ids)
        users = User.get_users()
        return jsonify(users=users)
    except Exception as ex:
        return jsonify(error=str(ex))
    finally:
        dao.close()
开发者ID:joegillon,项目名称:bluestreets_app,代码行数:24,代码来源:users.py


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