2
這是我收到的錯誤:The view extraio.file_uploader.views.Upload_File didn't return an HttpResponse object.
「的觀點沒有返回HttpResponse對象」
有人能看到我在做什麼錯在這裏?我似乎無法弄清楚爲什麼我會得到這個異常,因爲我返回一個HttpResponseRedirect。
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from models import Files
from forms import Upload_File_Form
def Upload_File(request):
if request.method == 'POST':
form = Upload_File_Form(request.POST, request.FILES)
if form.is_valid():
for f in request.FILES.get_list('file'):
f.save()
orgfilename = Files(orgname=f.name)
orgfilename.save()
return HttpResponseRedirect('success.html')
else:
form = Upload_File_Form()
return render_to_response('upload.html', {'form': form})