【发布时间】:2018-12-19 15:05:38
【问题描述】:
我将 HTML 元素列表从 html 通过 post 传递给 views.py,但我只是得到最后一个值。
这是我使用的 html 代码,这一行的多行
<input name="idborrow[]" id="borrow" value='+element[i].id+'>
这是我在views.py中的代码
if request.method == 'POST':
idborrow = request.POST.get('idborrow[]', '')
print (idborrow)
在控制台中,它只打印最后一个值,如何获取整个值列表
【问题讨论】:
-
request.POST.getlist('idborrow[]')?
标签: html django python-3.x django-2.0