我在django有问题。实际上,我会在views.py的同一函数中返回许多render(request,template.html,{'x':val});我的意思是template.html中的变量x将使用许多不同的值val更改,并且每个值都在给定的时刻。
代码views.py:
def test(request):
test1 = "true"
test2 = "true"
if test1 == "true":
val= 50
return render(request,'template.html', {'x':val})
if test2 == "true":
val= 20
return render(request, 'template.html', {'x':val})
首先,它会在其充值页面之后在tempalte.html中返回值50,并返回值20。
有人可以帮助我吗?
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句