diff options
Diffstat (limited to 'docs')
| -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 | ||||
| -rw-r--r-- | docs/index.md | 12 | ||||
| -rw-r--r-- | docs/topics/browsable-api.md | 4 | ||||
| -rw-r--r-- | docs/tutorial/1-serialization.md | 16 | ||||
| -rw-r--r-- | docs/tutorial/2-requests-and-responses.md | 10 | ||||
| -rw-r--r-- | docs/tutorial/3-class-based-views.md | 14 | ||||
| -rw-r--r-- | docs/tutorial/6-resource-orientated-projects.md | 4 | 
13 files changed, 69 insertions, 67 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 diff --git a/docs/index.md b/docs/index.md index 2376d38e..e7db5dbc 100644 --- a/docs/index.md +++ b/docs/index.md @@ -40,20 +40,22 @@ Install using `pip`, including any optional packages you want...      pip install -r requirements.txt      pip install -r optionals.txt -Add `djangorestframework` to your `INSTALLED_APPS`. +Add `rest_framework` to your `INSTALLED_APPS`.      INSTALLED_APPS = (          ... -        'djangorestframework',         +        'rest_framework',              )  If you're intending to use the browserable API you'll want to add REST framework's login and logout views.  Add the following to your root `urls.py` file.      urlpatterns = patterns('',          ... -        url(r'^api-auth/', include('djangorestframework.urls', namespace='djangorestframework')) +        url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))      ) -  + +Note that the base URL can be whatever you want, but you must include `rest_framework.urls` with the `rest_framework` namespace. +  ## Quickstart  **TODO** @@ -110,7 +112,7 @@ Build the docs:  Run the tests: -    ./djangorestframework/runtests/runtests.py +    ./rest_framework/runtests/runtests.py  ## License diff --git a/docs/topics/browsable-api.md b/docs/topics/browsable-api.md index 6f8920bb..ed27752f 100644 --- a/docs/topics/browsable-api.md +++ b/docs/topics/browsable-api.md @@ -4,7 +4,7 @@ API may stand for Application *Programming* Interface, but humans have to be abl  ## URLs -If you include fully-qualified URLs in your resource output, they will be 'urlized' and made clickable for easy browsing by humans. The `djangorestframework` package includes a [`reverse`][drfreverse] helper for this purpose. +If you include fully-qualified URLs in your resource output, they will be 'urlized' and made clickable for easy browsing by humans. The `rest_framework` package includes a [`reverse`][drfreverse] helper for this purpose.  ## Formats @@ -14,7 +14,7 @@ By default, the API will return the format specified by the headers, which in th  ## Customizing -To customize the look-and-feel, create a template called `api.html` and add it to your project, eg: `templates/djangorestframework/api.html`, that extends the `djangorestframework/base.html` template. +To customize the look-and-feel, create a template called `api.html` and add it to your project, eg: `templates/rest_framework/api.html`, that extends the `rest_framework/base.html` template.  The included browsable API template is built with [Bootstrap (2.1.1)][bootstrap], making it easy to customize the look-and-feel. diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md index 34990084..e3656bd0 100644 --- a/docs/tutorial/1-serialization.md +++ b/docs/tutorial/1-serialization.md @@ -45,11 +45,11 @@ The simplest way to get up and running will probably be to use an `sqlite3` data          }      } -We'll also need to add our new `blog` app and the `djangorestframework` app to `INSTALLED_APPS`. +We'll also need to add our new `blog` app and the `rest_framework` app to `INSTALLED_APPS`.      INSTALLED_APPS = (          ... -        'djangorestframework', +        'rest_framework',          'blog'      ) @@ -81,7 +81,7 @@ Don't forget to sync the database for the first time.  We're going to create a simple Web API that we can use to edit these comment objects with.  The first thing we need is a way of serializing and deserializing the objects into representations such as `json`.  We do this by declaring serializers, that work very similarly to Django's forms.  Create a file in the project named `serializers.py` and add the following.      from blog import models -    from djangorestframework import serializers +    from rest_framework import serializers      class CommentSerializer(serializers.Serializer): @@ -114,8 +114,8 @@ Okay, once we've got a few imports out of the way, we'd better create a few comm      from blog.models import Comment      from blog.serializers import CommentSerializer -    from djangorestframework.renderers import JSONRenderer -    from djangorestframework.parsers import JSONParser +    from rest_framework.renderers import JSONRenderer +    from rest_framework.parsers import JSONParser      c1 = Comment(email='leila@example.com', content='nothing to say')      c2 = Comment(email='tom@example.com', content='foo bar') @@ -159,8 +159,8 @@ Edit the `blog/views.py` file, and add the following.      from blog.models import Comment      from blog.serializers import CommentSerializer -    from djangorestframework.renderers import JSONRenderer -    from djangorestframework.parsers import JSONParser +    from rest_framework.renderers import JSONRenderer +    from rest_framework.parsers import JSONParser      from django.http import HttpResponse @@ -251,4 +251,4 @@ Our API views don't do anything particularly special at the moment, beyond serve  We'll see how we can start to improve things in [part 2 of the tutorial][tut-2].  [virtualenv]: http://www.virtualenv.org/en/latest/index.html -[tut-2]: 2-requests-and-responses.md
\ No newline at end of file +[tut-2]: 2-requests-and-responses.md diff --git a/docs/tutorial/2-requests-and-responses.md b/docs/tutorial/2-requests-and-responses.md index 906f11d0..d889b1e0 100644 --- a/docs/tutorial/2-requests-and-responses.md +++ b/docs/tutorial/2-requests-and-responses.md @@ -40,9 +40,9 @@ We don't need our `JSONResponse` class anymore, so go ahead and delete that.  On      from blog.models import Comment      from blog.serializers import CommentSerializer -    from djangorestframework import status -    from djangorestframework.decorators import api_view -    from djangorestframework.response import Response +    from rest_framework import status +    from rest_framework.decorators import api_view +    from rest_framework.response import Response      @api_view(['GET', 'POST'])      def comment_root(request): @@ -112,7 +112,7 @@ and  Now update the `urls.py` file slightly, to append a set of `format_suffix_patterns` in addition to the existing URLs.      from django.conf.urls import patterns, url -    from djangorestframework.urlpatterns import format_suffix_patterns +    from rest_framework.urlpatterns import format_suffix_patterns      urlpatterns = patterns('blogpost.views',          url(r'^$', 'comment_root'), @@ -148,4 +148,4 @@ In [tutorial part 3][tut-3], we'll start using class based views, and see how ge  [devserver]: http://127.0.0.1:8000/  [browseable-api]: ../topics/browsable-api.md  [tut-1]: 1-serialization.md -[tut-3]: 3-class-based-views.md
\ No newline at end of file +[tut-3]: 3-class-based-views.md diff --git a/docs/tutorial/3-class-based-views.md b/docs/tutorial/3-class-based-views.md index 79866f0d..8db29308 100644 --- a/docs/tutorial/3-class-based-views.md +++ b/docs/tutorial/3-class-based-views.md @@ -9,9 +9,9 @@ We'll start by rewriting the root view as a class based view.  All this involves      from blog.models import Comment      from blog.serializers import CommentSerializer      from django.http import Http404 -    from djangorestframework.views import APIView -    from djangorestframework.response import Response -    from djangorestframework import status +    from rest_framework.views import APIView +    from rest_framework.response import Response +    from rest_framework import status      class CommentRoot(APIView): @@ -68,7 +68,7 @@ That's looking good.  Again, it's still pretty similar to the function based vie  We'll also need to refactor our URLconf slightly now we're using class based views.      from django.conf.urls import patterns, url -    from djangorestframework.urlpatterns import format_suffix_patterns +    from rest_framework.urlpatterns import format_suffix_patterns      from blogpost import views      urlpatterns = patterns('', @@ -90,8 +90,8 @@ Let's take a look at how we can compose our views by using the mixin classes.      from blog.models import Comment      from blog.serializers import CommentSerializer -    from djangorestframework import mixins -    from djangorestframework import generics +    from rest_framework import mixins +    from rest_framework import generics      class CommentRoot(mixins.ListModelMixin,                        mixins.CreateModelMixin, @@ -133,7 +133,7 @@ Using the mixin classes we've rewritten the views to use slightly less code than      from blog.models import Comment      from blog.serializers import CommentSerializer -    from djangorestframework import generics +    from rest_framework import generics      class CommentRoot(generics.RootAPIView): diff --git a/docs/tutorial/6-resource-orientated-projects.md b/docs/tutorial/6-resource-orientated-projects.md index 7da409fb..3c3e7fed 100644 --- a/docs/tutorial/6-resource-orientated-projects.md +++ b/docs/tutorial/6-resource-orientated-projects.md @@ -50,7 +50,7 @@ The handler methods only get bound to the actions when we define the URLConf. He  Right now that hasn't really saved us a lot of code.  However, now that we're using Resources rather than Views, we actually don't need to design the urlconf ourselves.  The conventions for wiring up resources into views and urls can be handled automatically, using `Router` classes.  All we need to do is register the appropriate resources with a router, and let it do the rest.  Here's our re-wired `urls.py` file.      from blog import resources -    from djangorestframework.routers import DefaultRouter +    from rest_framework.routers import DefaultRouter      router = DefaultRouter()      router.register(resources.BlogPostResource) @@ -73,4 +73,4 @@ We've reached the end of our tutorial.  If you want to get more involved in the  **Now go build some awesome things.** -[twitter]: https://twitter.com/_tomchristie
\ No newline at end of file +[twitter]: https://twitter.com/_tomchristie | 
