From 77da335ce8ff3b475ac03794f6e2b782316ab9a9 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Tue, 15 Jul 2014 15:02:49 +0100 Subject: [PATCH] Latest docs --- api-guide/authentication.html | 24 ++++++++++++---- api-guide/content-negotiation.html | 24 ++++++++++++---- api-guide/exceptions.html | 24 ++++++++++++---- api-guide/fields.html | 24 ++++++++++++---- api-guide/filtering.html | 28 +++++++++++++------ api-guide/format-suffixes.html | 24 ++++++++++++---- api-guide/generic-views.html | 24 ++++++++++++---- api-guide/pagination.html | 24 ++++++++++++---- api-guide/parsers.html | 24 ++++++++++++---- api-guide/permissions.html | 27 ++++++++++++++---- api-guide/relations.html | 24 ++++++++++++---- api-guide/renderers.html | 24 ++++++++++++---- api-guide/requests.html | 24 ++++++++++++---- api-guide/responses.html | 24 ++++++++++++---- api-guide/reverse.html | 24 ++++++++++++---- api-guide/routers.html | 24 ++++++++++++---- api-guide/serializers.html | 24 ++++++++++++---- api-guide/settings.html | 24 ++++++++++++---- api-guide/status-codes.html | 24 ++++++++++++---- api-guide/testing.html | 24 ++++++++++++---- api-guide/throttling.html | 24 ++++++++++++---- api-guide/views.html | 24 ++++++++++++---- api-guide/viewsets.html | 24 ++++++++++++---- index.html | 28 ++++++++++++++----- topics/2.2-announcement.html | 24 ++++++++++++---- topics/2.3-announcement.html | 24 ++++++++++++---- topics/ajax-csrf-cors.html | 24 ++++++++++++---- topics/browsable-api.html | 24 ++++++++++++---- topics/browser-enhancements.html | 24 ++++++++++++---- topics/contributing.html | 24 ++++++++++++---- topics/credits.html | 24 ++++++++++++---- topics/documenting-your-api.html | 24 ++++++++++++---- topics/release-notes.html | 24 ++++++++++++---- topics/rest-framework-2-announcement.html | 24 ++++++++++++---- topics/rest-hypermedia-hateoas.html | 24 ++++++++++++---- topics/writable-nested-serializers.html | 24 ++++++++++++---- tutorial/1-serialization.html | 24 ++++++++++++---- tutorial/2-requests-and-responses.html | 24 ++++++++++++---- tutorial/3-class-based-views.html | 24 ++++++++++++---- .../4-authentication-and-permissions.html | 24 ++++++++++++---- .../5-relationships-and-hyperlinked-apis.html | 24 ++++++++++++---- tutorial/6-viewsets-and-routers.html | 24 ++++++++++++---- tutorial/quickstart.html | 24 ++++++++++++---- 43 files changed, 823 insertions(+), 220 deletions(-) diff --git a/api-guide/authentication.html b/api-guide/authentication.html index 890914691..bc61cdd2f 100644 --- a/api-guide/authentication.html +++ b/api-guide/authentication.html @@ -33,6 +33,21 @@ })(); + @@ -189,11 +204,9 @@
  • Hawk HTTP Authentication
  • HTTP Signature Authentication
  • -
    - - - -
    +
    + +
    @@ -505,6 +518,7 @@ class ExampleAuthentication(authentication.BaseAuthentication): + + @@ -174,11 +189,9 @@
  • Example
  • Setting the content negotiation
  • -
    - - - -
    +
    + +
    @@ -276,6 +289,7 @@ class NoNegotiationView(APIView): + + @@ -181,11 +196,9 @@
  • UnsupportedMediaType
  • Throttled
  • -
    - - - -
    +
    + +
    @@ -313,6 +326,7 @@ class ServiceUnavailable(APIException): + + @@ -196,11 +211,9 @@
  • Third party packages
  • DRF Compound Fields
  • -
    - - - -
    +
    + +
    @@ -459,6 +472,7 @@ class ColourField(serializers.WritableField): + + @@ -186,11 +201,9 @@
  • Third party packages
  • Django REST framework chain
  • -
    - - - -
    +
    + +
    @@ -355,15 +368,13 @@ class ProductFilter(django_filters.FilterSet):

    This enables us to make queries like:

    http://example.com/api/products?manufacturer__name=foo
     
    -

    This is nice, but it shows underlying model structure in REST API, which may -be undesired, but you can use:

    +

    This is nice, but it exposes the Django's double underscore convention as part of the API. If you instead want to explicitly name the filter argument you can instead explicitly include it on the FilterSet class:

    import django_filters
     from myapp.models import Product
     from myapp.serializers import ProductSerializer
     from rest_framework import generics
     
     class ProductFilter(django_filters.FilterSet):
    -
         manufacturer = django_filters.CharFilter(name="manufacturer__name")
     
         class Meta:
    @@ -520,6 +531,7 @@ class ProductFilter(django_filters.FilterSet):
         
         
         
    +
         
    +    
       
       
     
    @@ -172,11 +187,9 @@
     
  • format_suffix_patterns
  • Accept headers vs. format suffixes
  • -
    - - - -
    +
    + +
    @@ -251,6 +264,7 @@ def comment_list(request, format=None): + + @@ -194,11 +209,9 @@
  • Third party packages
  • Django REST Framework bulk
  • -
    - - - -
    +
    + +
    @@ -475,6 +488,7 @@ class BaseRetrieveUpdateDestroyView(MultipleFieldLookupMixin, + + @@ -178,11 +193,9 @@
  • Third party packages
  • DRF-extensions
  • -
    - - - -
    +
    + +
    @@ -334,6 +347,7 @@ class CustomPaginationSerializer(pagination.BasePaginationSerializer): + + @@ -184,11 +199,9 @@
  • MessagePack
  • CamelCase JSON
  • -
    - - - -
    +
    + +
    @@ -340,6 +353,7 @@ def parse(self, stream, media_type=None, parser_context=None): + + @@ -187,11 +202,9 @@
  • Composed Permissions
  • REST Condition
  • -
    - - - -
    +
    + +
    @@ -223,6 +236,9 @@ or if you override the get_object method on a generic view, then yo self.check_object_permissions(self.request, obj) return obj
    +

    Limitations of object level permissions

    +

    For performance reasons the generic views will not automatically apply object level permissions to each instance in a queryset when returning a list of objects.

    +

    Often when you're using object level permissions you'll also want to filter the queryset appropriately, to ensure that users only have visibility onto instances that they are permitted to view.

    Setting the permission policy

    The default permission policy may be set globally, using the DEFAULT_PERMISSION_CLASSES setting. For example.

    REST_FRAMEWORK = {
    @@ -383,6 +399,7 @@ class BlacklistPermission(permissions.BasePermission):
         
         
         
    +
         
    +    
       
       
     
    @@ -188,11 +203,9 @@
     
  • Third Party Packages
  • DRF Nested Routers
  • -
    - - - -
    +
    + +
    @@ -584,6 +597,7 @@ In the 2.4 release, these parts of the API will be removed entirely.

    + + @@ -198,11 +213,9 @@
  • UltraJSON
  • CamelCase JSON
  • -
    - - - -
    +
    + +
    @@ -523,6 +536,7 @@ In this case you can underspecify the media types it should respond to, by using + + @@ -184,11 +199,9 @@
  • .stream
  • Standard HttpRequest attributes
  • -
    - - - -
    +
    + +
    @@ -282,6 +295,7 @@ + + @@ -182,11 +197,9 @@
  • Standard HttpResponse attributes
  • .render()
  • -
    - - - -
    +
    + +
    @@ -265,6 +278,7 @@ response['Cache-Control'] = 'no-cache' + + @@ -172,11 +187,9 @@
  • reverse
  • reverse_lazy
  • -
    - - - -
    +
    + +
    @@ -240,6 +253,7 @@ class APIRootView(APIView): + + @@ -181,11 +196,9 @@
  • wq.db
  • DRF-extensions
  • -
    - - - -
    +
    + +
    @@ -354,6 +367,7 @@ app.router.register_model(MyModel) + + @@ -191,11 +206,9 @@
  • Dynamically modifying fields
  • Customising the default fields
  • -
    - - - -
    +
    + +
    @@ -666,6 +679,7 @@ The ModelSerializer class lets you automatically create a Serialize + + @@ -180,11 +195,9 @@
  • View names and descriptions
  • Miscellaneous settings
  • -
    - - - -
    +
    + +
    @@ -438,6 +451,7 @@ If set to None then generic filtering is disabled.

    + + @@ -176,11 +191,9 @@
  • Server Error - 5xx
  • Helper functions
  • -
    - - - -
    +
    + +
    @@ -300,6 +313,7 @@ is_server_error() # 5xx + + @@ -186,11 +201,9 @@
  • Setting the default format
  • Setting the available formats
  • -
    - - - -
    +
    + +
    @@ -412,6 +425,7 @@ self.assertEqual(response.content, '{"username": "lauren", "id": 4}') + + @@ -179,11 +194,9 @@
  • Custom throttles
  • Example
  • -
    - - - -
    +
    + +
    @@ -344,6 +357,7 @@ class UploadView(APIView): + + @@ -177,11 +192,9 @@
  • @api_view()
  • API policy decorators
  • -
    - - - -
    +
    + +
    @@ -321,6 +334,7 @@ def view(request): + + @@ -179,11 +194,9 @@
  • Custom ViewSet base classes
  • Example
  • -
    - - - -
    +
    + +
    @@ -398,6 +411,7 @@ class UserViewSet(viewsets.ModelViewSet): + + @@ -181,12 +196,10 @@
  • Security
  • License
  • -
    - -

    The team behind REST framework is launching a new API service.

    -

    If you want to be first in line when we start issuing invitations, please sign up here.

    - -
    +
    +
    + +
    @@ -227,7 +240,7 @@
  • Authentication policies including OAuth1a and OAuth2 out of the box.
  • Serialization that supports both ORM and non-ORM data sources.
  • Customizable all the way down - just use regular function-based views if you don't need the more powerful features.
  • -
  • Extensive documentation, great community support, and a growing package ecosystem.
  • +
  • Extensive documentation, and great community support.
  • Used and trusted by large companies such as Mozilla and Eventbrite.

  • @@ -431,6 +444,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    + + @@ -174,11 +189,9 @@
  • Community
  • API changes
  • -
    - - - -
    +
    + +
    @@ -311,6 +324,7 @@ serializer.data + + @@ -186,11 +201,9 @@
  • Version 2.2 API changes
  • What comes next?
  • -
    - - - -
    +
    + +
    @@ -404,6 +417,7 @@ urlpatterns = patterns('', + + @@ -173,11 +188,9 @@
  • CSRF protection
  • CORS
  • -
    - - - -
    +
    + +
    @@ -224,6 +237,7 @@ + + @@ -173,11 +188,9 @@
  • Formats
  • Customizing
  • -
    - - - -
    +
    + +
    @@ -318,6 +331,7 @@ class BookSerializer(serializers.ModelSerializer): + + @@ -176,11 +191,9 @@
  • URL based format suffixes
  • Doesn't HTML5 support PUT and DELETE forms?
  • -
    - - - -
    +
    + +
    @@ -258,6 +271,7 @@ as well as how to support content types other than form-encoded data.

    + + @@ -185,11 +200,9 @@
  • Getting started
  • Linking to your package
  • -
    - - - -
    +
    + +
    @@ -335,6 +348,7 @@ More text... + + @@ -172,11 +187,9 @@
  • Additional thanks
  • Contact
  • -
    - - - -
    +
    + +
    @@ -397,6 +410,7 @@ + + @@ -173,11 +188,9 @@
  • Self describing APIs
  • The hypermedia approach
  • -
    - - - -
    +
    + +
    @@ -263,6 +276,7 @@ + + @@ -181,11 +196,9 @@
  • 0.2.x series
  • 0.1.x series
  • -
    - - - -
    +
    + +
    @@ -801,6 +814,7 @@ + + @@ -178,11 +193,9 @@
  • Documentation
  • Summary
  • -
    - - - -
    +
    + +
    @@ -259,6 +272,7 @@ + + @@ -173,11 +188,9 @@
  • What REST framework provides.
  • What REST framework doesn't provide.
  • -
    - - - -
    +
    + +
    @@ -227,6 +240,7 @@ the Design of Network-based Software Architectures. + + @@ -171,11 +186,9 @@
  • Writable nested serializers
  • One-to-many data structures
  • -
    - - - -
    +
    + +
    @@ -235,6 +248,7 @@ class ToDoListSerializer(serializers.ModelSerializer): + + @@ -180,11 +195,9 @@
  • Testing our first attempt at a Web API
  • Where are we now
  • -
    - - - -
    +
    + +
    @@ -499,6 +512,7 @@ Quit the server with CONTROL-C. + + @@ -178,11 +193,9 @@
  • How's it looking?
  • What's next?
  • -
    - - - -
    +
    + +
    @@ -338,6 +351,7 @@ curl -X POST http://127.0.0.1:8000/snippets/ -d '{"code": "print 456"}' -H "Cont + + @@ -173,11 +188,9 @@
  • Using mixins
  • Using generic class based views
  • -
    - - - -
    +
    + +
    @@ -331,6 +344,7 @@ class SnippetDetail(generics.RetrieveUpdateDestroyAPIView): + + @@ -179,11 +194,9 @@
  • Authenticating with the API
  • Summary
  • -
    - - - -
    +
    + +
    @@ -367,6 +380,7 @@ class IsOwnerOrReadOnly(permissions.BasePermission): + + @@ -176,11 +191,9 @@
  • Adding pagination
  • Browsing the API
  • -
    - - - -
    +
    + +
    @@ -333,6 +346,7 @@ urlpatterns += patterns('', + + @@ -176,11 +191,9 @@
  • Reviewing our work
  • Onwards and upwards
  • -
    - - - -
    +
    + +
    @@ -322,6 +335,7 @@ urlpatterns = patterns('', + + @@ -176,11 +191,9 @@
  • Settings
  • Testing our API
  • -
    - - - -
    +
    + +
    @@ -348,6 +361,7 @@ REST_FRAMEWORK = { +