當前位置: 首頁>>代碼示例>>Python>>正文


Python Account.get_by_uuid方法代碼示例

本文整理匯總了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'))
開發者ID:ehazlett,項目名稱:opencloud,代碼行數:20,代碼來源:views.py

示例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)
開發者ID:ehazlett,項目名稱:opencloud,代碼行數:20,代碼來源:views.py

示例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)
開發者ID:ehazlett,項目名稱:opencloud,代碼行數:8,代碼來源:views.py

示例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'))
開發者ID:ehazlett,項目名稱:opencloud,代碼行數:7,代碼來源:views.py


注:本文中的accounts.models.Account.get_by_uuid方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。