本文转自:http://www.djangofoo.com/93/request-post-get-multiple-values
The QueryDict.getlist() allows to get all the checkbox(or select list) values from therequest.POST/GET object. Let’s assume we have a simple form with the following checkboxes. Each checkbox contains an ID of an artist. In views.py :
1
<form method
=
"post"
action
=
"">
2
...
3
<
input
type
=
"checkbox"
value
=
"1"
name
=
"artists"
>
4
<
input
type
=
"checkbox"
value
=
"2"
name
=
"artists"
>
5
<
input
type
=
"checkbox"
value
=
"3"
name
=
"artists"
>
6
...
7
<
/
form>
1
def
handle(request):
2
if
request.method
=
=
'POST'
:
3
artists
=
request.POST.getlist(
'artists'
)
# now artists is a list of [1,2,3]
呵呵,谢谢
VaTG790i.最好的<a href=http://www.kyfei.com>网站推广软件</a>,
非常好
....................
;ui;普i;uighur;ui;ui;个
在unix网络编程中看到了关于TCP/IP的一些内容,我感觉还是写的不够。正在下载中,一定
下载地址呢