Skip to content

Commit

Permalink
Fix erronous request.files docs, and incorrect request.FILES behavior.
Browse files Browse the repository at this point in the history
…Closes #3261.
  • Loading branch information
tomchristie committed Aug 11, 2015
1 parent b7e47e3 commit 0df99a6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
8 changes: 0 additions & 8 deletions docs/api-guide/requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ For more details see the [parsers documentation].

For clarity inside your code, we recommend using `request.query_params` instead of the Django's standard `request.GET`. Doing so will help keep your codebase more correct and obvious - any HTTP method type may include query parameters, not just `GET` requests.

## .DATA and .FILES

The old-style version 2.x `request.DATA` and `request.FILES` attributes are still available, but are now pending deprecation in favor of the unified `request.data` attribute.

## .QUERY_PARAMS

The old-style version 2.x `request.QUERY_PARAMS` attribute is still available, but is now pending deprecation in favor of the more pythonic `request.query_params`.

## .parsers

The `APIView` class or `@api_view` decorator will ensure that this property is automatically set to a list of `Parser` instances, based on the `parser_classes` set on the view or based on the `DEFAULT_PARSER_CLASSES` setting.
Expand Down
1 change: 0 additions & 1 deletion docs/topics/3.2-announcement.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Our supported Django versions are now 1.5.6+, 1.6.3+, 1.7 and 1.8.
There are no new deprecations in 3.2, although a number of existing deprecations have now escalated in line with our deprecation policy.

* `request.DATA` was put on the deprecation path in 3.0. It has now been removed and its usage will result in an error. Use the more pythonic style of `request.data` instead.
* `request.FILES` was put on the deprecation path in 3.0. It has now been removed and its usage will result in an error. Use the more pythonic style of `request.files` instead.
* `request.QUERY_PARAMS` was put on the deprecation path in 3.0. It has now been removed and its usage will result in an error. Use the more pythonic style of `request.query_params` instead.
* The following `ModelSerializer.Meta` options have now been removed: `write_only_fields`, `view_name`, `lookup_field`. Use the more general `extra_kwargs` option instead.

Expand Down
6 changes: 5 additions & 1 deletion rest_framework/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,11 @@ def DATA(self):
@property
def FILES(self):
# Leave this one alone for backwards compat with Django's request.FILES
return self.files
# Different from the other two cases, which are not valid property
# names on the WSGIRequest class.
if not _hasattr(self, '_files'):
self._load_data_and_files()
return self._files

@property
def QUERY_PARAMS(self):
Expand Down

0 comments on commit 0df99a6

Please sign in to comment.