views传入了一个boolean类型值pay,明明是False,但是html模板判断时依然if pay依然执行了语句
{% if pay %}
<a href="#">pay{{ pay }}</a>
{% elif hfut %}
<a href="/pay">hfut{{ hfut }}</a>
{% elif getin %}
<a href="/getin">getin{{ getin }}</a>
{% else %}
<a href="/login">login</a>
{% endif %}
views.py
def index(req):
username = req.COOKIES.get('username','')
balance = req.COOKIES.get('balance', '')
getin = req.COOKIES.get('is_getin','')
hfut= req.COOKIES.get('hfut', '')
pay = req.COOKIES.get('pay','')
return render(req,'lakers.html' ,context={'username':username, 'balance':balance, 'getin':getin, 'hfut':hfut, 'pay':pay})