Hi Philip. 

This is unlikely(!!!) to be changed. As it says on the ticket, it's 
considered a feature, not a bug. 

The usual case is to need a single value from the query string, so `[]` and 
`get()` both return scalars. 
`getList()` exists specifically for the case where you do want multiple 
values. 

Having said all that, I think a lot of people new to Django get up and 
running, and well beyond that, 
without ever knowing that `getList()` exists. (I guess they discover it, 
with Google/StackOverflow, first 
time they need it.) 

A quick scan of the tutorial and docs suggests that `getList()` is probably 
under-documented. (It appears just twice in `request-response.txt`.) 
Maybe an addition to the beginning of the QueryDict section 
<https://docs.djangoproject.com/en/2.0/ref/request-response/#querydict-objects> 
demonstrating 
the basic use-cases would be a good addition.

Kind Regards,

Carlton



On Thursday, 19 July 2018 08:19:34 UTC+2, Philip Lee wrote:
>
> I was trapped by the behavior of `QueryDict.get(_key_, _default=None_)` 
> for a bit while before consulting the documentation , for that *If the key 
> has more than one value, it returns the last value.*
> So as for  multiple values for the same key,  is returning the last value 
> of key more often expected than returning all the values of the key(that is 
> the behavior of `QueryDict.getlist(_key_, _default=None_)` right now)?  If 
> not, I'd suggest to change the behavior of `QueryDict.get(_key_, 
> _default=None_)` to return all the values of the same key for a natural 
> usage so that avoid confusing problems caused by the current behavior like 
>
> https://stackoverflow.com/questions/50044626/querydict-returning-strange-value-in-django
> https://code.djangoproject.com/ticket/1130 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/7718573c-e380-4158-afa0-4fd37eb03154%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to