index.html
<form method="post" >
请输入数字<input type="text" name="mustnumber" />
<br/>
<input type=‘submit‘ value="提交" />
</form>
{{result}}
在表单中输入数字在控制台打印
hello.py
def hi(request):
dataset={‘result‘:‘必须输入数字‘}
print request.POST.get(‘mustnumber‘)
return render_to_response("index.html",dataset)
时间: 2024-11-08 07:45:24