本文整理匯總了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'))