本文整理匯總了Python中models.Request.content方法的典型用法代碼示例。如果您正苦於以下問題:Python Request.content方法的具體用法?Python Request.content怎麽用?Python Request.content使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models.Request
的用法示例。
在下文中一共展示了Request.content方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: process
# 需要導入模塊: from models import Request [as 別名]
# 或者: from models.Request import content [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)