本文整理汇总了Python中accounts.models.Account.get_by_uuid方法的典型用法代码示例。如果您正苦于以下问题:Python Account.get_by_uuid方法的具体用法?Python Account.get_by_uuid怎么用?Python Account.get_by_uuid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类accounts.models.Account
的用法示例。
在下文中一共展示了Account.get_by_uuid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_default_images
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import get_by_uuid [as 别名]
def update_default_images(uuid=None):
account = Account.get_by_uuid(uuid)
image_names = request.form.getlist('image_name')
image_ids = request.form.getlist('image_id')
image_regions = request.form.getlist('image_region')
images = zip(image_names, image_ids, image_regions)
default_images = []
for img in images:
d = {
'name': img[0],
'id': img[1],
'region': img[2],
}
default_images.append(d)
account.default_images = default_images
account.save()
flash('{0} {1}'.format(account.name, messages.DEFAULT_IMAGES_UPDATED), 'success')
return redirect(url_for('accounts.accounts'))
示例2: edit_account
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import get_by_uuid [as 别名]
def edit_account(uuid=None):
account = Account.get_by_uuid(uuid)
if request.method == 'POST':
if account:
account.name = request.form.get('name')
account.provider = request.form.get('provider')
account.provider_id = request.form.get('provider_id')
account.provider_key = request.form.get('provider_key')
account.keypair = request.form.get('keypair', '')
account.organization = request.form.get('organization', '')
account.save()
flash(messages.ACCOUNT_UPDATED)
return redirect(url_for('accounts.accounts'))
ctx = {
'account': account,
'organizations': Organization.query.ascending('name').all()
}
return render_template('accounts/edit_account.html', **ctx)
示例3: default_images
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import get_by_uuid [as 别名]
def default_images(uuid=None):
account = Account.get_by_uuid(uuid)
ctx = {
'account': account,
}
return render_template('accounts/_default_images.html', **ctx)
示例4: delete_account
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import get_by_uuid [as 别名]
def delete_account(uuid=None):
account = Account.get_by_uuid(uuid)
if account:
account.remove()
return redirect(url_for('accounts.accounts'))