def upload(request):
user = request.user
upload_form = UploadForm(request.POST or None, request.FILES or None)
if request.method == "POST":
if upload_form.is_valid():
my_model = upload_form.save(commit=False)
my_model.user = user
print my_model.src
my_model.save()
return render_to_response('index.html',, context_instance=RequestContext(request))
return render_to_response('index.html', {'upload_form': upload_form}, context_instance=RequestContext(request))
上传后如何重定向到/summary/1/
(/summary/saved object id/)