Django笔记3

2017-07-13  本文已影响0人  F4A3

对detail.html 页面进行值的传递

1
forloop.counter

indicates how many times the for tag has gone through its loop

Since we’re creating a POST form (which can have the effect of modifying data), we need to worry about Cross Site Request Forgeries. Thankfully, you don’t have to worry too hard, because Django comes with a very easy-to-use system for protecting against it. In short, all POST forms that are targeted at internal URLs should use the {% csrf_token %}

在views.py中编写vote方法,构造投票逻辑

2.png

在views.py中编写result方法.对投票后的结果进行显示.较为简单,进行question的传递即可

3.png

编写result的html页面

4.png
上一篇 下一篇

猜你喜欢

热点阅读