[Answered ]-Why can't I fully get the value which is a list in python dictionary (Django request)?

1👍

Well actually this is a feature and nothing is wrong with your code, read this.

The reasoning behind this is that an API method should consistently return either a string or a list, but never both. The common case in web applications is for a form key to be associated with a single value, so that’s what the [] syntax does. getlist() is there for the occasions (like yours) when you intend to use a key multiple times for a single value.

You can get the list like this:

blogpost_tags = request.POST.getlist('tags')

I hope this helped 🙂

👤Sepehr

Leave a comment