本文整理汇总了Python中models.Request.instances_used方法的典型用法代码示例。如果您正苦于以下问题:Python Request.instances_used方法的具体用法?Python Request.instances_used怎么用?Python Request.instances_used使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Request
的用法示例。
在下文中一共展示了Request.instances_used方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process
# 需要导入模块: from models import Request [as 别名]
# 或者: from models.Request import instances_used [as 别名]
def process(request):
if request.method == 'POST':
form = UploadedFileForm(request.POST, request.FILES)
if form.is_valid():
motive = form.cleaned_data["motive"]
instances_used = form.cleaned_data["instance_num"]
seed_content = request.FILES['file'].read()
fetcher = Fetcher("fetch_queue", instances_used)
instances_ids = fetcher.fetch(seed_content)
#Could not parse directly from form because of the file
req_model = Request()
req_model.motive = motive
req_model.instances_used = instances_used
req_model.user = request.user
req_model.content = seed_content
req_model.instances_ids = json.dumps(instances_ids)
req_model.save()
return HttpResponseRedirect("/process/%d" % req_model.id)