1

I am absolutely baffled about this. I am using a checkbox form to get a list of items (tags) to view from the user, so that they can customize the view on their page.

data=request.POST

data has the value:

<QueryDict: {…, u'tags': [u' blue', u'hi', u'sky'], …}>

but when I try to retrieve the list of tags:

debug=data[‘tags’]

debug stores only the value

u'sky'

I cannot for the life of me figure out why this is happening, but it's totally screwing me over. Any suggestions?

1 Answer 1

5

request.POST is a QueryDict - if you're expecting multiple values for a key, use its getlist method.:

debug = data.getlist('tags')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.