我有一个表格,我试图提交,但每当我点击提交按钮Django把我放入403禁止页错误。我不知道怎么解决这个问题。请帮忙。这是使用物化CSS完成的。你知道吗
你知道吗页面.html地址:
<form action="/present/" method="POST">
{% csrf_token %}
<p>
<input type="checkbox" id="completed" name="completed" />
<label for="completed">Present</label>
</p>
<input class="waves-effect waves-light btn" type='submit'/>
</form>
你知道吗视图.py地址:
def present(request):
completed = request.GET.get('pre')
if request.POST.get('completed', '') == 'on':
print("Succes!")
else:
print("Nope")
#above coode doesn't work either for detecting whether or not the
checkbox was selected.
return render(request, 'main/test.html')
它将工作,只是刷新您的页面或关闭您的标签,然后尝试。你知道吗
相关问题 更多 >
编程相关推荐