diff options
| author | Tom Christie | 2012-09-20 13:06:27 +0100 | 
|---|---|---|
| committer | Tom Christie | 2012-09-20 13:06:27 +0100 | 
| commit | 4b691c402707775c3048a90531024f3bc5be6f91 (patch) | |
| tree | 3adfc54b0d8b70e4ea78edf7091f7827fa68f47b /docs/api-guide | |
| parent | a1bcfbfe926621820832e32b0427601e1140b4f7 (diff) | |
| download | django-rest-framework-4b691c402707775c3048a90531024f3bc5be6f91.tar.bz2 | |
Change package name: djangorestframework -> rest_framework
Diffstat (limited to 'docs/api-guide')
| -rw-r--r-- | docs/api-guide/authentication.md | 14 | ||||
| -rw-r--r-- | docs/api-guide/permissions.md | 6 | ||||
| -rw-r--r-- | docs/api-guide/requests.md | 6 | ||||
| -rw-r--r-- | docs/api-guide/reverse.md | 6 | ||||
| -rw-r--r-- | docs/api-guide/settings.md | 28 | ||||
| -rw-r--r-- | docs/api-guide/status-codes.md | 2 | ||||
| -rw-r--r-- | docs/api-guide/throttling.md | 14 | 
7 files changed, 38 insertions, 38 deletions
| diff --git a/docs/api-guide/authentication.md b/docs/api-guide/authentication.md index 79950946..f24c6a81 100644 --- a/docs/api-guide/authentication.md +++ b/docs/api-guide/authentication.md @@ -28,10 +28,10 @@ The value of `request.user` and `request.auth` for unauthenticated requests can  The default authentication policy may be set globally, using the `DEFAULT_AUTHENTICATION` setting.  For example. -    API_SETTINGS = { +    REST_FRAMEWORK = {          'DEFAULT_AUTHENTICATION': ( -            'djangorestframework.authentication.UserBasicAuthentication', -            'djangorestframework.authentication.SessionAuthentication', +            'rest_framework.authentication.UserBasicAuthentication', +            'rest_framework.authentication.SessionAuthentication',          )      } @@ -75,11 +75,11 @@ If successfully authenticated, `BasicAuthentication` provides the following cred  This policy uses a simple token-based HTTP Authentication scheme.  Token authentication is appropriate for client-server setups, such as native desktop and mobile clients. -To use the `TokenAuthentication` policy, include `djangorestframework.authtoken` in your `INSTALLED_APPS` setting. +To use the `TokenAuthentication` policy, include `rest_framework.authtoken` in your `INSTALLED_APPS` setting.  You'll also need to create tokens for your users. -    from djangorestframework.authtoken.models import Token +    from rest_framework.authtoken.models import Token      token = Token.objects.create(user=...)      print token.key @@ -91,7 +91,7 @@ For clients to authenticate, the token key should be included in the `Authorizat  If successfully authenticated, `TokenAuthentication` provides the following credentials.  * `request.user` will be a `django.contrib.auth.models.User` instance. -* `request.auth` will be a `djangorestframework.tokenauth.models.BasicToken` instance. +* `request.auth` will be a `rest_framework.tokenauth.models.BasicToken` instance.  **Note:** If you use `TokenAuthentication` in production you must ensure that your API is only available over `https` only. @@ -102,7 +102,7 @@ This policy uses the [OAuth 2.0][oauth] protocol to authenticate requests.  OAut  If successfully authenticated, `OAuthAuthentication` provides the following credentials.  * `request.user` will be a `django.contrib.auth.models.User` instance. -* `request.auth` will be a `djangorestframework.models.OAuthToken` instance. +* `request.auth` will be a `rest_framework.models.OAuthToken` instance.  ## SessionAuthentication diff --git a/docs/api-guide/permissions.md b/docs/api-guide/permissions.md index fafef305..e0ceb1ea 100644 --- a/docs/api-guide/permissions.md +++ b/docs/api-guide/permissions.md @@ -27,9 +27,9 @@ Object level permissions are run by REST framework's generic views when `.get_ob  The default permission policy may be set globally, using the `DEFAULT_PERMISSIONS` setting.  For example. -    API_SETTINGS = { +    REST_FRAMEWORK = {          'DEFAULT_PERMISSIONS': ( -            'djangorestframework.permissions.IsAuthenticated', +            'rest_framework.permissions.IsAuthenticated',          )      } @@ -97,4 +97,4 @@ The method should return `True` if the request should be granted access, and `Fa  [authentication]: authentication.md  [throttling]: throttling.md  [contribauth]: https://docs.djangoproject.com/en/1.0/topics/auth/#permissions -[guardian]: https://github.com/lukaszb/django-guardian
\ No newline at end of file +[guardian]: https://github.com/lukaszb/django-guardian diff --git a/docs/api-guide/requests.md b/docs/api-guide/requests.md index 6746bb20..b223da80 100644 --- a/docs/api-guide/requests.md +++ b/docs/api-guide/requests.md @@ -49,7 +49,7 @@ This allows you to support file uploads from multiple content-types.  For exampl  `request.parsers` may no longer be altered once `request.DATA`, `request.FILES` or `request.POST` have been accessed. -If you're using the `djangorestframework.views.View` class... **[TODO]** +If you're using the `rest_framework.views.View` class... **[TODO]**  ## .stream @@ -63,6 +63,6 @@ You will not typically need to access `request.stream`, unless you're writing a  `request.authentication` may no longer be altered once `request.user` or `request.auth` have been accessed. -If you're using the `djangorestframework.views.View` class... **[TODO]** +If you're using the `rest_framework.views.View` class... **[TODO]** -[cite]: https://groups.google.com/d/topic/django-developers/dxI4qVzrBY4/discussion
\ No newline at end of file +[cite]: https://groups.google.com/d/topic/django-developers/dxI4qVzrBY4/discussion diff --git a/docs/api-guide/reverse.md b/docs/api-guide/reverse.md index f3cb0c64..3fa654c0 100644 --- a/docs/api-guide/reverse.md +++ b/docs/api-guide/reverse.md @@ -23,8 +23,8 @@ There's no requirement for you to use them, but if you do then the self-describi  Has the same behavior as [`django.core.urlresolvers.reverse`][reverse], except that it returns a fully qualified URL, using the request to determine the host and port. -    from djangorestframework.utils import reverse -    from djangorestframework.views import APIView +    from rest_framework.utils import reverse +    from rest_framework.views import APIView  	class MyView(APIView):  	    def get(self, request): @@ -40,4 +40,4 @@ Has the same behavior as [`django.core.urlresolvers.reverse_lazy`][reverse-lazy]  [cite]: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_1_5  [reverse]: https://docs.djangoproject.com/en/dev/topics/http/urls/#reverse -[reverse-lazy]: https://docs.djangoproject.com/en/dev/topics/http/urls/#reverse-lazy
\ No newline at end of file +[reverse-lazy]: https://docs.djangoproject.com/en/dev/topics/http/urls/#reverse-lazy diff --git a/docs/api-guide/settings.md b/docs/api-guide/settings.md index 2513928c..0f66e85e 100644 --- a/docs/api-guide/settings.md +++ b/docs/api-guide/settings.md @@ -6,16 +6,16 @@  >  > — [The Zen of Python][cite] -Configuration for REST framework is all namespaced inside a single Django setting, named `API_SETTINGS`. +Configuration for REST framework is all namespaced inside a single Django setting, named `REST_FRAMEWORK`.  For example your project's `settings.py` file might include something like this: -    API_SETTINGS = { +    REST_FRAMEWORK = {          'DEFAULT_RENDERERS': ( -            'djangorestframework.renderers.YAMLRenderer', +            'rest_framework.renderers.YAMLRenderer',          )          'DEFAULT_PARSERS': ( -            'djangorestframework.parsers.YAMLParser', +            'rest_framework.parsers.YAMLParser',          )      } @@ -24,7 +24,7 @@ For example your project's `settings.py` file might include something like this:  If you need to access the values of REST framework's API settings in your project,  you should use the `api_settings` object.  For example. -    from djangorestframework.settings import api_settings +    from rest_framework.settings import api_settings      print api_settings.DEFAULT_AUTHENTICATION @@ -37,9 +37,9 @@ A list or tuple of renderer classes, that determines the default set of renderer  Default:      ( -        'djangorestframework.renderers.JSONRenderer', -        'djangorestframework.renderers.DocumentingHTMLRenderer' -        'djangorestframework.renderers.TemplateHTMLRenderer' +        'rest_framework.renderers.JSONRenderer', +        'rest_framework.renderers.DocumentingHTMLRenderer' +        'rest_framework.renderers.TemplateHTMLRenderer'      )  ## DEFAULT_PARSERS @@ -49,8 +49,8 @@ A list or tuple of parser classes, that determines the default set of parsers us  Default:      ( -        'djangorestframework.parsers.JSONParser', -        'djangorestframework.parsers.FormParser' +        'rest_framework.parsers.JSONParser', +        'rest_framework.parsers.FormParser'      )  ## DEFAULT_AUTHENTICATION @@ -60,8 +60,8 @@ A list or tuple of authentication classes, that determines the default set of au  Default:      ( -        'djangorestframework.authentication.SessionAuthentication', -        'djangorestframework.authentication.UserBasicAuthentication' +        'rest_framework.authentication.SessionAuthentication', +        'rest_framework.authentication.UserBasicAuthentication'      )  ## DEFAULT_PERMISSIONS @@ -80,13 +80,13 @@ Default: `()`  **TODO** -Default: `djangorestframework.serializers.ModelSerializer` +Default: `rest_framework.serializers.ModelSerializer`  ## DEFAULT_PAGINATION_SERIALIZER  **TODO** -Default: `djangorestframework.pagination.PaginationSerializer` +Default: `rest_framework.pagination.PaginationSerializer`  ## FORMAT_SUFFIX_KWARG diff --git a/docs/api-guide/status-codes.md b/docs/api-guide/status-codes.md index 6693c79f..401f45ce 100644 --- a/docs/api-guide/status-codes.md +++ b/docs/api-guide/status-codes.md @@ -8,7 +8,7 @@  Using bare status codes in your responses isn't recommended.  REST framework includes a set of named constants that you can use to make more code more obvious and readable. -    from djangorestframework import status +    from rest_framework import status      def empty_view(self):          content = {'please move along': 'nothing to see here'} diff --git a/docs/api-guide/throttling.md b/docs/api-guide/throttling.md index 10997801..7861e9ba 100644 --- a/docs/api-guide/throttling.md +++ b/docs/api-guide/throttling.md @@ -29,10 +29,10 @@ If any throttle check fails an `exceptions.Throttled` exception will be raised,  The default throttling policy may be set globally, using the `DEFAULT_THROTTLES` and `DEFAULT_THROTTLE_RATES` settings.  For example. -    API_SETTINGS = { +    REST_FRAMEWORK = {          'DEFAULT_THROTTLES': ( -            'djangorestframework.throttles.AnonThrottle', -            'djangorestframework.throttles.UserThrottle', +            'rest_framework.throttles.AnonThrottle', +            'rest_framework.throttles.UserThrottle',          )          'DEFAULT_THROTTLE_RATES': {              'anon': '100/day', @@ -95,7 +95,7 @@ For example, multiple user throttle rates could be implemented by using the foll  ...and the following settings. -    API_SETTINGS = { +    REST_FRAMEWORK = {          'DEFAULT_THROTTLES': (              'example.throttles.BurstRateThrottle',              'example.throttles.SustainedRateThrottle', @@ -130,9 +130,9 @@ For example, given the following views...  ...and the following settings. -    API_SETTINGS = { +    REST_FRAMEWORK = {          'DEFAULT_THROTTLES': ( -            'djangorestframework.throttles.ScopedRateThrottle', +            'rest_framework.throttles.ScopedRateThrottle',          )          'DEFAULT_THROTTLE_RATES': {              'contacts': '1000/day', @@ -148,4 +148,4 @@ To create a custom throttle, override `BaseThrottle` and implement `.allow_reque  Optionally you may also override the `.wait()` method.  If implemented, `.wait()` should return a recomended number of seconds to wait before attempting the next request, or `None`.  The `.wait()` method will only be called if `.check_throttle()` has previously returned `False`. -[permissions]: permissions.md
\ No newline at end of file +[permissions]: permissions.md | 
