html中把字符串转化为int,需要在django模板中将字符串转换为int

我试图将url参数传递给这样的django模板…

response = render_to_string('persistConTemplate.html', request.GET)

这是来自我的views.py文件的调用行。 persistConTemplate.html是我的模板和request.GET的名称.GET是包含url参数的字典。

在模板中,我尝试使用这样的参数之一…

{% for item in (numItems) %}

item {{item}}

{% endfor %}

numItems是我在我的请求中发送的url参数之一…

http:/someDomain/persistentConTest.html/?numItems=12

当我尝试上面的for循环,我得到一个这样的输出….

image 1 image 2

我期待并希望看到图像印刷12次…

image 1 image 2 image 3 image 4 image 5 image 6 image 7 image 8 image 9 image 10 image 11 image 12

有人可以告诉我我出了什么问题吗?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值