Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
Handle select multiple on django

I have this on template

<select name="document" id="document" multiple="">
        <option value="2">test 1</option>
        <option value="3">test 2</option>
</select>

When I select two options when I accept the request in views.py I got correctly 2 options selected

self.request.POST // It prints 'document': ['2', '3']

But when I try to select the field like this

self.request.POST['document'] // It prints only '3'

How can I select 2 options?

Thanks

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use .getlist(…) [Django-doc] to obtain all the values associated with a given key.

You thus can here work with:

request.POST.getlist('document')
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!