本文整理汇总了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
示例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