diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
index 30ce28d..9f250f2 100644
a
|
b
|
class MultiValueDict(dict):
|
230 | 230 | 'Simon' |
231 | 231 | >>> d.getlist('name') |
232 | 232 | ['Adrian', 'Simon'] |
| 233 | >>> d.getlist('doesnotexist') |
| 234 | [] |
| 235 | >>> d.getlist('doesnotexist', ['Adrian', 'Simon']) |
| 236 | ['Adrian', 'Simon'] |
233 | 237 | >>> d.get('lastname', 'nonexistent') |
234 | 238 | 'nonexistent' |
235 | 239 | >>> d.setlist('lastname', ['Holovaty', 'Willison']) |
… |
… |
class MultiValueDict(dict):
|
300 | 304 | return default |
301 | 305 | return val |
302 | 306 | |
303 | | def getlist(self, key): |
| 307 | def getlist(self, key, default=None): |
304 | 308 | """ |
305 | 309 | Returns the list of values for the passed key. If key doesn't exist, |
306 | | then an empty list is returned. |
| 310 | the default value is returned. |
307 | 311 | """ |
308 | 312 | try: |
309 | 313 | return super(MultiValueDict, self).__getitem__(key) |
310 | 314 | except KeyError: |
| 315 | if default is not None: |
| 316 | return default |
311 | 317 | return [] |
312 | 318 | |
313 | 319 | def setlist(self, key, list_): |
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
index 380210d..6232ba8 100644
a
|
b
|
In addition, ``QueryDict`` has the following methods:
|
356 | 356 | standard library. The copy will be mutable -- that is, you can change its |
357 | 357 | values. |
358 | 358 | |
359 | | .. method:: QueryDict.getlist(key) |
| 359 | .. method:: QueryDict.getlist(key, default) |
360 | 360 | |
361 | 361 | Returns the data with the requested key, as a Python list. Returns an |
362 | | empty list if the key doesn't exist. It's guaranteed to return a list of |
363 | | some sort. |
| 362 | empty list if the key doesn't exist and no default value was provided. |
| 363 | It's guaranteed to return a list of some sort unless the default value |
| 364 | was no list. |
364 | 365 | |
365 | 366 | .. method:: QueryDict.setlist(key, list_) |
366 | 367 | |