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


Python Account.admin方法代码示例

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


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

示例1: make_account

# 需要导入模块: from openspending.model.account import Account [as 别名]
# 或者: from openspending.model.account.Account import admin [as 别名]
def make_account(name='test', fullname='Test User',
                 email='[email protected]', 
                 admin=False, verified=True):
    from openspending.model.account import Account

    # First see if the account already exists and if so, return it
    account = Account.by_email(email)
    if account:
        return account

    # Account didn't exist so we create it and return it
    account = Account()
    account.fullname = fullname
    account.email = email
    account.admin = admin
    account.verified = verified
    db.session.add(account)
    db.session.commit()
    return account
开发者ID:nathanhilbert,项目名称:FPA_Core,代码行数:21,代码来源:helpers.py

示例2: make_account

# 需要导入模块: from openspending.model.account import Account [as 别名]
# 或者: from openspending.model.account.Account import admin [as 别名]
def make_account(name='test', fullname='Test User',
                 email='[email protected]', twitter='testuser',
                 admin=False):
    from openspending.model.account import Account

    # First see if the account already exists and if so, return it
    account = Account.by_name(name)
    if account:
        return account

    # Account didn't exist so we create it and return it
    account = Account()
    account.name = name
    account.fullname = fullname
    account.email = email
    account.twitter_handle = twitter
    account.admin = admin
    db.session.add(account)
    db.session.commit()

    return account
开发者ID:ToroidalATLAS,项目名称:openspending,代码行数:23,代码来源:helpers.py


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