当前位置: 首页>>代码示例>>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;未经允许,请勿转载。