0
我將文件上傳到服務器,並希望返回到視圖render_upload_content
一些消息像Files uploaded successfully.
這是我的代碼:如何在django中使用HttpResponseRedirect發送context_instance和一些消息?
#(r'^cmanager/upload$', 'mypublisher.views.render_upload_content'),
def render_upload_content(request):
'''render template'''
return render_to_response('cmanager_upload.html',{}, context_instance=RequestContext(request))
#(r'^cmanager/upload/save$', 'mypublisher.views.save_content'),
def save_content(request):
'''save form data with files'''
cmanager = ContentManager()
message = cmanager.handle_uploaded_file(request)
#Now I'm using "render_to_response" to display message on same template
return render_to_response('cmanager_upload.html',{"message": message}, context_instance=RequestContext(request))
我怎麼能發送message
以及context_instance=RequestContext(request)
使用HttpresponseRedirect
模板。
預先感謝您!
感謝您的回覆。我不知道。 –