当前位置: 首页>>代码示例>>Python>>正文


Python WorkshopGame.get_instance方法代码示例

本文整理汇总了Python中models.WorkshopGame.get_instance方法的典型用法代码示例。如果您正苦于以下问题:Python WorkshopGame.get_instance方法的具体用法?Python WorkshopGame.get_instance怎么用?Python WorkshopGame.get_instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.WorkshopGame的用法示例。


在下文中一共展示了WorkshopGame.get_instance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: kick_off

# 需要导入模块: from models import WorkshopGame [as 别名]
# 或者: from models.WorkshopGame import get_instance [as 别名]
def kick_off(request, player):
    player = get_object_or_404(Player, pk=player)

    sgs = player.playergroup_set.filter(owner=WorkshopGame.get_instance())
    for s in sgs:
        s.players.remove(player)

    return redirect('workshop_home')
开发者ID:AndreiRO,项目名称:wouso,代码行数:10,代码来源:cpanel.py

示例2: add_group

# 需要导入模块: from models import WorkshopGame [as 别名]
# 或者: from models.WorkshopGame import get_instance [as 别名]
def add_group(request):
    if request.method == 'POST':
        form = AGForm(request.POST)
        if form.is_valid():
            sg = form.save()
            sg.owner = WorkshopGame.get_instance()
            sg.save()
            return redirect('ws_edit_spot', day=sg.day, hour=sg.hour)
    else:
        form = AGForm()

    return render_to_response('workshop/cpanel/addgroup.html',
                        {'module': 'workshop',
                         'form': form,
                         },
                        context_instance=RequestContext(request)
    )
开发者ID:alexef,项目名称:wouso-1,代码行数:19,代码来源:cpanel.py

示例3: edit_group

# 需要导入模块: from models import WorkshopGame [as 别名]
# 或者: from models.WorkshopGame import get_instance [as 别名]
def edit_group(request, semigroup):
    semigroup = get_object_or_404(Semigroup, pk=semigroup)

    if request.method == 'POST':
        form = AGForm(request.POST, instance=semigroup)
        if form.is_valid():
            sg = form.save()
            sg.owner = WorkshopGame.get_instance()
            sg.save()
            return redirect('ws_edit_spot', day=sg.day, hour=sg.hour)
    else:
        form = AGForm(instance=semigroup)

    return render_to_response('workshop/cpanel/editgroup.html',
            {'module': 'workshop',
             'form': form,
             'instance': semigroup,
             },
        context_instance=RequestContext(request)
    )
开发者ID:alexef,项目名称:wouso-1,代码行数:22,代码来源:cpanel.py

示例4: form_valid

# 需要导入模块: from models import WorkshopGame [as 别名]
# 或者: from models.WorkshopGame import get_instance [as 别名]
 def form_valid(self, form):
     sg = form.save()
     sg.owner = WorkshopGame.get_instance()
     sg.save()
     return redirect('ws_edit_spot', day=sg.day, hour=sg.hour)
开发者ID:AndreiRO,项目名称:wouso,代码行数:7,代码来源:cpanel.py


注:本文中的models.WorkshopGame.get_instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。