コード例 #1
0
ファイル: views.py プロジェクト: BGCX261/zhe-trunk-hg-to-git
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})
コード例 #2
0
ファイル: views.py プロジェクト: BGCX261/zhe-trunk-hg-to-git
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})
コード例 #3
0
ファイル: views.py プロジェクト: BGCX261/zhe-trunk-hg-to-git
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()})
コード例 #4
0
ファイル: views.py プロジェクト: BGCX261/zhe-trunk-hg-to-git
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()
        })