本文整理汇总了Python中models.WorkshopGame.get_question_category方法的典型用法代码示例。如果您正苦于以下问题:Python WorkshopGame.get_question_category方法的具体用法?Python WorkshopGame.get_question_category怎么用?Python WorkshopGame.get_question_category使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.WorkshopGame
的用法示例。
在下文中一共展示了WorkshopGame.get_question_category方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: schedule_change
# 需要导入模块: from models import WorkshopGame [as 别名]
# 或者: from models.WorkshopGame import get_question_category [as 别名]
def schedule_change(request, schedule=None):
class SCForm(forms.ModelForm):
class Meta:
model = Schedule
fields = ('name', 'start_date', 'end_date')
if schedule:
schedule = get_object_or_404(Schedule, pk=schedule)
if request.method == 'POST':
form = SCForm(request.POST, instance=schedule)
if form.is_valid():
sc = form.save()
sc.category = WorkshopGame.get_question_category()
sc.save()
return redirect('ws_schedule')
else:
form = SCForm(instance=schedule)
return render_to_response('workshop/cpanel/schedule_change.html',
{'module': 'workshop',
'form': form,
'instance': schedule},
context_instance=RequestContext(request)
)
示例2: schedule
# 需要导入模块: from models import WorkshopGame [as 别名]
# 或者: from models.WorkshopGame import get_question_category [as 别名]
def schedule(request):
schedules = Schedule.objects.all().order_by('start_date', 'name')
return render_to_response('workshop/cpanel/schedule.html',
{'module': 'workshop',
'schedules': schedules,
'category': WorkshopGame.get_question_category(),
'page': 'schedule'},
context_instance=RequestContext(request)
)
示例3: schedule_change
# 需要导入模块: from models import WorkshopGame [as 别名]
# 或者: from models.WorkshopGame import get_question_category [as 别名]
def schedule_change(request, schedule=None):
if schedule:
schedule = get_object_or_404(Schedule, pk=schedule)
if request.method == 'POST':
form = SCForm(request.POST, instance=schedule)
if form.is_valid():
sc = form.save()
sc.category = WorkshopGame.get_question_category()
sc.save()
return redirect('ws_schedule')
else:
form = SCForm(instance=schedule)
return render_to_response('workshop/cpanel/schedule_change.html',
{'module': 'workshop',
'form': form,
'instance': schedule,
'page': 'schedule'},
context_instance=RequestContext(request)
)
示例4: form_valid
# 需要导入模块: from models import WorkshopGame [as 别名]
# 或者: from models.WorkshopGame import get_question_category [as 别名]
def form_valid(self, form):
sc = form.save()
sc.category = WorkshopGame.get_question_category()
sc.save()
return redirect('ws_schedule')