On 11/21/05, Kevin <[EMAIL PROTECTED]> wrote:
> I'm converting a PHP application over to django and one thing I took
> for granted was PHPs conversion of inputs with the name "input[]" into
> an array automatically.  Since django nor python seem to support that
> conversion, what do people suggest for receiving 1 to N inputs on a
> request.POST?

Django certainly supports that! Just use request.POST.getlist(). That
method is guaranteed to return a list.

The docs are here:
http://www.djangoproject.com/documentation/request_response/#querydict-objects

Example:

<select name="item" multiple="multiple"><options......></select>

Python code:

items = request.POST.getlist('item')

No ugly "[0]" and "[1]" are needed. :-D

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Reply via email to