切换视图 - Django

时间:2016-02-07 01:46:25

标签: python django

当我尝试渲染页面不起作用时,这是一个简单的例子,我所做的是通过按钮从html发送表单中的数据, 然后将其重定向到另一个页面。

数据正确到达,我已从服务器检查过。

views.py

def index(request):
    context={}
    if request.method == 'POST': # If the form has been submitted...    
        form=list(dict(request.POST)['data[]'])
        return render(request,'bala/pdf.html',{'form':form})
    else:
        return render(request,'bala/index.html',context)

0 个答案:

没有答案