本文整理汇总了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')
示例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)
)
示例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)
)
示例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)