mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #6465 -- Tweaked MergeDict.getlist() to work with Django's MultiValueDict class. Thanks, Matt McClanahan.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7062 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -20,6 +20,19 @@
|
||||
>>> md2['chris']
|
||||
'cool'
|
||||
|
||||
MergeDict can merge MultiValueDicts
|
||||
>>> multi1 = MultiValueDict({'key1': ['value1'], 'key2': ['value2', 'value3']})
|
||||
>>> multi2 = MultiValueDict({'key2': ['value4'], 'key4': ['value5', 'value6']})
|
||||
>>> mm = MergeDict(multi1, multi2)
|
||||
|
||||
# Although 'key2' appears in both dictionaries, only the first value is used.
|
||||
>>> mm.getlist('key2')
|
||||
['value2', 'value3']
|
||||
>>> mm.getlist('key4')
|
||||
['value5', 'value6']
|
||||
>>> mm.getlist('undefined')
|
||||
[]
|
||||
|
||||
### MultiValueDict ##########################################################
|
||||
|
||||
>>> d = MultiValueDict({'name': ['Adrian', 'Simon'], 'position': ['Developer']})
|
||||
|
||||
Reference in New Issue
Block a user