mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-11 04:07:39 +03:00
commit
9078fd4f68
|
@ -398,7 +398,7 @@ HTTP digest authentication is a widely implemented scheme that was intended to r
|
||||||
|
|
||||||
## Django OAuth Toolkit
|
## Django OAuth Toolkit
|
||||||
|
|
||||||
The [Django OAuth Toolkit][django-oauth-toolkit] package provides OAuth 2.0 support, and works with Python 2.7 and Python 3.3+. The package is maintained by [Evonove][evonove] and uses the excelllent [OAuthLib][oauthlib]. The package is well documented, and comes as a recommended alternative for OAuth 2.0 support.
|
The [Django OAuth Toolkit][django-oauth-toolkit] package provides OAuth 2.0 support, and works with Python 2.7 and Python 3.3+. The package is maintained by [Evonove][evonove] and uses the excellent [OAuthLib][oauthlib]. The package is well documented, and comes as a recommended alternative for OAuth 2.0 support.
|
||||||
|
|
||||||
## Django OAuth2 Consumer
|
## Django OAuth2 Consumer
|
||||||
|
|
||||||
|
|
|
@ -374,7 +374,7 @@ Using custom base classes is a good option if you have custom behavior that cons
|
||||||
|
|
||||||
Prior to version 3.0 the REST framework mixins treated `PUT` as either an update or a create operation, depending on if the object already existed or not.
|
Prior to version 3.0 the REST framework mixins treated `PUT` as either an update or a create operation, depending on if the object already existed or not.
|
||||||
|
|
||||||
Allowing `PUT` as create operations is problematic, as it necessarily exposes information about the existence or non-existance of objects. It's also not obvious that transparently allowing re-creating of previously deleted instances is necessarily a better default behavior than simply returning `404` responses.
|
Allowing `PUT` as create operations is problematic, as it necessarily exposes information about the existence or non-existence of objects. It's also not obvious that transparently allowing re-creating of previously deleted instances is necessarily a better default behavior than simply returning `404` responses.
|
||||||
|
|
||||||
Both styles "`PUT` as 404" and "`PUT` as create" can be valid in different circumstances, but from version 3.0 onwards we now use 404 behavior as the default, due to it being simpler and more obvious.
|
Both styles "`PUT` as 404" and "`PUT` as create" can be valid in different circumstances, but from version 3.0 onwards we now use 404 behavior as the default, due to it being simpler and more obvious.
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ This field is always read-only.
|
||||||
|
|
||||||
**Arguments**:
|
**Arguments**:
|
||||||
|
|
||||||
* `view_name` - The view name that should be used as the target of the relationship. If you're using [the standard router classes][routers] this wil be a string with the format `<model_name>-detail`. **required**.
|
* `view_name` - The view name that should be used as the target of the relationship. If you're using [the standard router classes][routers] this will be a string with the format `<model_name>-detail`. **required**.
|
||||||
* `lookup_field` - The field on the target that should be used for the lookup. Should correspond to a URL keyword argument on the referenced view. Default is `'pk'`.
|
* `lookup_field` - The field on the target that should be used for the lookup. Should correspond to a URL keyword argument on the referenced view. Default is `'pk'`.
|
||||||
* `format` - If using format suffixes, hyperlinked fields will use the same format suffix for the target unless overridden by using the `format` argument.
|
* `format` - If using format suffixes, hyperlinked fields will use the same format suffix for the target unless overridden by using the `format` argument.
|
||||||
|
|
||||||
|
|
|
@ -154,13 +154,13 @@ Default: `None`
|
||||||
|
|
||||||
### SEARCH_PARAM
|
### SEARCH_PARAM
|
||||||
|
|
||||||
The name of a query paramater, which can be used to specify the search term used by `SearchFilter`.
|
The name of a query parameter, which can be used to specify the search term used by `SearchFilter`.
|
||||||
|
|
||||||
Default: `search`
|
Default: `search`
|
||||||
|
|
||||||
#### ORDERING_PARAM
|
#### ORDERING_PARAM
|
||||||
|
|
||||||
The name of a query paramater, which can be used to specify the ordering of results returned by `OrderingFilter`.
|
The name of a query parameter, which can be used to specify the ordering of results returned by `OrderingFilter`.
|
||||||
|
|
||||||
Default: `ordering`
|
Default: `ordering`
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ When set to `False`, JSON responses will escape non-ascii characters, like so:
|
||||||
|
|
||||||
{"unicode black star":"\u2605"}
|
{"unicode black star":"\u2605"}
|
||||||
|
|
||||||
Both styles conform to [RFC 4627][rfc4627], and are syntactically valid JSON. The unicode style is prefered as being more user-friendly when inspecting API responses.
|
Both styles conform to [RFC 4627][rfc4627], and are syntactically valid JSON. The unicode style is preferred as being more user-friendly when inspecting API responses.
|
||||||
|
|
||||||
Default: `True`
|
Default: `True`
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ If you need to strictly identify unique client IP addresses, you'll need to firs
|
||||||
|
|
||||||
It is important to understand that if you configure the `NUM_PROXIES` setting, then all clients behind a unique [NAT'd](http://en.wikipedia.org/wiki/Network_address_translation) gateway will be treated as a single client.
|
It is important to understand that if you configure the `NUM_PROXIES` setting, then all clients behind a unique [NAT'd](http://en.wikipedia.org/wiki/Network_address_translation) gateway will be treated as a single client.
|
||||||
|
|
||||||
Further context on how the `X-Forwarded-For` header works, and identifing a remote client IP can be [found here][identifing-clients].
|
Further context on how the `X-Forwarded-For` header works, and identifying a remote client IP can be [found here][identifing-clients].
|
||||||
|
|
||||||
## Setting up the cache
|
## Setting up the cache
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ If you need to use a cache other than `'default'`, you can do so by creating a c
|
||||||
class CustomAnonRateThrottle(AnonRateThrottle):
|
class CustomAnonRateThrottle(AnonRateThrottle):
|
||||||
cache = get_cache('alternate')
|
cache = get_cache('alternate')
|
||||||
|
|
||||||
You'll need to rememeber to also set your custom throttle class in the `'DEFAULT_THROTTLE_CLASSES'` settings key, or using the `throttle_classes` view attribute.
|
You'll need to remember to also set your custom throttle class in the `'DEFAULT_THROTTLE_CLASSES'` settings key, or using the `throttle_classes` view attribute.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user