def upload_file(request): if request.method == 'POST': form = UploadFileForm(request.POST, request.FILES) if form.is_valid(): form.save() #save_file(f) return HttpResponseRedirect('/') form = UploadFileForm() return direct_to_template(request, 'upload.html', {'form': form})
def upload_handler(request): view_url = reverse('up5.upload_test.views.upload_handler') if request.method == 'POST': form = UploadFileForm(request.POST, request.FILES) if form.is_valid(): form.save() return HttpResponseRedirect(view_url) upload_url, upload_data = prepare_upload(request, view_url) form = UploadFileForm() print(request.user.social_auth.get().extra_data) return direct_to_template(request, 'upload2.html', {'form':form, 'upload_url': upload_url, 'upload_data': upload_data, 'uploads': reversed(UploadFileModel.objects.all()), 'user': request.user.social_auth.all()})
def upload_handler(request): view_url = reverse('up5.upload_test.views.upload_handler') if request.method == 'POST': form = UploadFileForm(request.POST, request.FILES) if form.is_valid(): form.save() return HttpResponseRedirect(view_url) upload_url, upload_data = prepare_upload(request, view_url) form = UploadFileForm() print(request.user.social_auth.get().extra_data) return direct_to_template( request, 'upload2.html', { 'form': form, 'upload_url': upload_url, 'upload_data': upload_data, 'uploads': reversed(UploadFileModel.objects.all()), 'user': request.user.social_auth.all() })