Pooria Ghajari
Pooria Ghajari

Reputation: 21

Many parameters with one name in form and get a list of them in

I have a form with dynamic fields..

When submit form, i have this:

   Localhost:8000/mysite.com/jobs_form?job="Job1"&job="Job2"

And i cant get all of them in django with request.POST.get("job")

What can i do?

Upvotes: 2

Views: 37

Answers (1)

willeM_ Van Onsem
willeM_ Van Onsem

Reputation: 477318

You can work with the .getlist(…) method [Django-doc] of the request.GET [Django-doc] querydict:

request.GET.getlist('job')

This will return a list with the two jobs, so ['Job1', 'Job2'].

Upvotes: 1

Related Questions