Deployed eb3d078a with MkDocs version: 0.16.3

This commit is contained in:
Carlton Gibson 2017-10-06 13:06:25 +01:00
parent 3530d134ea
commit 91a7179528
66 changed files with 1563 additions and 219 deletions

View File

@ -318,6 +318,10 @@
<a href="/topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="/topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="/topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -744,7 +748,9 @@ class UserList(generics.ListCreateAPIView):
for field in self.lookup_fields:
if self.kwargs[field]: # Ignore empty fields.
filter[field] = self.kwargs[field]
return get_object_or_404(queryset, **filter) # Lookup the object
obj = get_object_or_404(queryset, **filter) # Lookup the object
self.check_object_permissions(self.request, obj)
return obj
</code></pre>
<p>You can then simply apply this mixin to a view or viewset anytime you need to apply the custom behavior.</p>
<pre><code>class RetrieveUserView(MultipleFieldLookupMixin, generics.RetrieveAPIView):

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -490,13 +494,13 @@
<p>Pagination is only performed automatically if you're using the generic views or viewsets. If you're using a regular <code>APIView</code>, you'll need to call into the pagination API yourself to ensure you return a paginated response. See the source code for the <code>mixins.ListModelMixin</code> and <code>generics.GenericAPIView</code> classes for an example.</p>
<p>Pagination can be turned off by setting the pagination class to <code>None</code>.</p>
<h2 id="setting-the-pagination-style"><a class="toclink" href="#setting-the-pagination-style">Setting the pagination style</a></h2>
<p>The default pagination style may be set globally, using the <code>DEFAULT_PAGINATION_CLASS</code> and <code>PAGE_SIZE</code> setting keys. For example, to use the built-in limit/offset pagination, you would do something like this:</p>
<p>The pagination style may be set globally, using the <code>DEFAULT_PAGINATION_CLASS</code> and <code>PAGE_SIZE</code> setting keys. For example, to use the built-in limit/offset pagination, you would do something like this:</p>
<pre><code>REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
'PAGE_SIZE': 100
}
</code></pre>
<p>Note that you need to set both the pagination class, and the page size that should be used.</p>
<p>Note that you need to set both the pagination class, and the page size that should be used. Both <code>DEFAULT_PAGINATION_CLASS</code> and <code>PAGE_SIZE</code> are <code>None</code> by default.</p>
<p>You can also set the pagination class on an individual view by using the <code>pagination_class</code> attribute. Typically you'll want to use the same pagination style throughout your API, although you might want to vary individual aspects of the pagination, such as default or maximum page size, on a per-view basis.</p>
<h2 id="modifying-the-pagination-style"><a class="toclink" href="#modifying-the-pagination-style">Modifying the pagination style</a></h2>
<p>If you want to modify particular aspects of the pagination style, you'll want to override one of the pagination classes, and set the attributes that you want to change.</p>
@ -540,7 +544,7 @@ class StandardResultsSetPagination(PageNumberPagination):
}
</code></pre>
<h4 id="setup"><a class="toclink" href="#setup">Setup</a></h4>
<p>To enable the <code>PageNumberPagination</code> style globally, use the following configuration, modifying the <code>PAGE_SIZE</code> as desired:</p>
<p>To enable the <code>PageNumberPagination</code> style globally, use the following configuration, and set the <code>PAGE_SIZE</code> as desired:</p>
<pre><code>REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 100
@ -612,6 +616,10 @@ class StandardResultsSetPagination(PageNumberPagination):
<li>Should be an unchanging value, such as a timestamp, slug, or other field that is only set once, on creation.</li>
<li>Should be unique, or nearly unique. Millisecond precision timestamps are a good example. This implementation of cursor pagination uses a smart "position plus offset" style that allows it to properly support not-strictly-unique values as the ordering.</li>
<li>Should be a non-nullable value that can be coerced to a string.</li>
<li>Should not be a float. Precision errors easily lead to incorrect results.
Hint: use decimals instead.
(If you already have a float field and must paginate on that, an
<a href="https://gist.github.com/keturn/8bc88525a183fd41c73ffb729b8865be#file-fpcursorpagination-py">example <code>CursorPagination</code> subclass that uses decimals to limit precision is available here</a>.)</li>
<li>The field should have a database index.</li>
</ul>
<p>Using an ordering field that does not satisfy these constraints will generally still work, but you'll be losing some of the benefits of cursor pagination.</p>
@ -647,8 +655,8 @@ class StandardResultsSetPagination(PageNumberPagination):
def get_paginated_response(self, data):
return Response({
'links': {
'next': self.get_next_link(),
'previous': self.get_previous_link()
'next': self.get_next_link(),
'previous': self.get_previous_link()
},
'count': self.page.paginator.count,
'results': data

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -514,7 +518,7 @@ or if you override the <code>get_object</code> method on a generic view, then yo
<p>This will either raise a <code>PermissionDenied</code> or <code>NotAuthenticated</code> exception, or simply return if the view has the appropriate permissions.</p>
<p>For example:</p>
<pre><code>def get_object(self):
obj = get_object_or_404(self.get_queryset())
obj = get_object_or_404(self.get_queryset(), pk=self.kwargs["pk"])
self.check_object_permissions(self.request, obj)
return obj
</code></pre>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -484,7 +488,7 @@
<hr />
<h1 id="attributes"><a class="toclink" href="#attributes">Attributes</a></h1>
<h2 id="data"><a class="toclink" href="#data">.data</a></h2>
<p>The unrendered content of a <code>Request</code> object.</p>
<p>The unrendered, serialized data of the response.</p>
<h2 id="status_code"><a class="toclink" href="#status_code">.status_code</a></h2>
<p>The numeric status code of the HTTP response.</p>
<h2 id="content"><a class="toclink" href="#content">.content</a></h2>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -383,7 +387,11 @@
<li>
<a href="#representing-schemas-internally">Representing schemas internally</a>
<a href="#install-core-api">Install Core API</a>
</li>
<li>
<a href="#internal-schema-representation">Internal schema representation</a>
</li>
<li>
@ -396,7 +404,25 @@
<li class="main">
<a href="#adding-a-schema">Adding a schema</a>
<a href="#creating-a-schema">Creating a schema</a>
</li>
<li>
<a href="#manual-schema-specification">Manual Schema Specification</a>
</li>
<li>
<a href="#automatic-schema-generation">Automatic Schema Generation</a>
</li>
<li>
<a href="#per-view-schema-customisation">Per-View Schema Customisation</a>
</li>
<li class="main">
<a href="#adding-a-schema-view">Adding a schema view</a>
</li>
@ -427,16 +453,6 @@
</li>
<li class="main">
<a href="#alternate-schema-formats">Alternate schema formats</a>
</li>
<li>
<a href="#example">Example</a>
</li>
<li class="main">
<a href="#api-reference">API Reference</a>
</li>
@ -446,11 +462,29 @@
<a href="#schemagenerator">SchemaGenerator</a>
</li>
<li>
<a href="#autoschema">AutoSchema</a>
</li>
<li>
<a href="#manualschema">ManualSchema</a>
</li>
<li>
<a href="#core-api">Core API</a>
</li>
<li class="main">
<a href="#third-party-packages">Third party packages</a>
</li>
<li>
<a href="#drf-openapi">DRF OpenAPI</a>
</li>
<div class="promo">
<hr/>
@ -479,7 +513,12 @@
<p>API schemas are a useful tool that allow for a range of use cases, including
generating reference documentation, or driving dynamic client libraries that
can interact with your API.</p>
<h2 id="representing-schemas-internally"><a class="toclink" href="#representing-schemas-internally">Representing schemas internally</a></h2>
<h2 id="install-core-api"><a class="toclink" href="#install-core-api">Install Core API</a></h2>
<p>You'll need to install the <code>coreapi</code> package in order to add schema support
for REST framework.</p>
<pre><code>pip install coreapi
</code></pre>
<h2 id="internal-schema-representation"><a class="toclink" href="#internal-schema-representation">Internal schema representation</a></h2>
<p>REST framework uses <a href="http://www.coreapi.org/">Core API</a> in order to model schema information in
a format-independent representation. This information can then be rendered
into various different schema formats, or used to generate API documentation.</p>
@ -530,9 +569,27 @@ has to be rendered into the actual bytes that are used in the response.</p>
<p><a href="http://www.coreapi.org/specification/encoding/#core-json-encoding">Core JSON</a> is designed as a canonical format for use with Core API.
REST framework includes a renderer class for handling this media type, which
is available as <code>renderers.CoreJSONRenderer</code>.</p>
<h3 id="alternate-schema-formats"><a class="toclink" href="#alternate-schema-formats">Alternate schema formats</a></h3>
<p>Other schema formats such as <a href="https://openapis.org/">Open API</a> ("Swagger"),
<a href="http://json-schema.org/latest/json-schema-hypermedia.html">JSON HyperSchema</a>, or <a href="https://apiblueprint.org/">API Blueprint</a> can
also be supported by implementing a custom renderer class.</p>
<a href="http://json-schema.org/latest/json-schema-hypermedia.html">JSON HyperSchema</a>, or <a href="https://apiblueprint.org/">API Blueprint</a> can also
be supported by implementing a custom renderer class that handles converting a
<code>Document</code> instance into a bytestring representation.</p>
<p>If there is a Core API codec package that supports encoding into the format you
want to use then implementing the renderer class can be done by using the codec.</p>
<h4 id="example"><a class="toclink" href="#example">Example</a></h4>
<p>For example, the <code>openapi_codec</code> package provides support for encoding or decoding
to the Open API ("Swagger") format:</p>
<pre><code>from rest_framework import renderers
from openapi_codec import OpenAPICodec
class SwaggerRenderer(renderers.BaseRenderer):
media_type = 'application/openapi+json'
format = 'swagger'
def render(self, data, media_type=None, renderer_context=None):
codec = OpenAPICodec()
return codec.dump(data)
</code></pre>
<h2 id="schemas-vs-hypermedia"><a class="toclink" href="#schemas-vs-hypermedia">Schemas vs Hypermedia</a></h2>
<p>It's worth pointing out here that Core API can also be used to model hypermedia
responses, which present an alternative interaction style to API schemas.</p>
@ -546,14 +603,108 @@ document, detailing both the current state and the available interactions.</p>
<p>Further information and support on building Hypermedia APIs with REST framework
is planned for a future version.</p>
<hr />
<h1 id="adding-a-schema"><a class="toclink" href="#adding-a-schema">Adding a schema</a></h1>
<p>You'll need to install the <code>coreapi</code> package in order to add schema support
for REST framework.</p>
<pre><code>pip install coreapi
</code></pre>
<h1 id="creating-a-schema"><a class="toclink" href="#creating-a-schema">Creating a schema</a></h1>
<p>REST framework includes functionality for auto-generating a schema,
or allows you to specify one explicitly. There are a few different ways to
add a schema to your API, depending on exactly what you need.</p>
or allows you to specify one explicitly.</p>
<h2 id="manual-schema-specification"><a class="toclink" href="#manual-schema-specification">Manual Schema Specification</a></h2>
<p>To manually specify a schema you create a Core API <code>Document</code>, similar to the
example above.</p>
<pre><code>schema = coreapi.Document(
title='Flight Search API',
content={
...
}
)
</code></pre>
<h2 id="automatic-schema-generation"><a class="toclink" href="#automatic-schema-generation">Automatic Schema Generation</a></h2>
<p>Automatic schema generation is provided by the <code>SchemaGenerator</code> class.</p>
<p><code>SchemaGenerator</code> processes a list of routed URL pattterns and compiles the
appropriately structured Core API Document.</p>
<p>Basic usage is just to provide the title for your schema and call
<code>get_schema()</code>:</p>
<pre><code>generator = schemas.SchemaGenerator(title='Flight Search API')
schema = generator.get_schema()
</code></pre>
<h2 id="per-view-schema-customisation"><a class="toclink" href="#per-view-schema-customisation">Per-View Schema Customisation</a></h2>
<p>By default, view introspection is performed by an <code>AutoSchema</code> instance
accessible via the <code>schema</code> attribute on <code>APIView</code>. This provides the
appropriate Core API <code>Link</code> object for the view, request method and path:</p>
<pre><code>auto_schema = view.schema
coreapi_link = auto_schema.get_link(...)
</code></pre>
<p>(In compiling the schema, <code>SchemaGenerator</code> calls <code>view.schema.get_link()</code> for
each view, allowed method and path.)</p>
<p>To customise the <code>Link</code> generation you may:</p>
<ul>
<li>
<p>Instantiate <code>AutoSchema</code> on your view with the <code>manual_fields</code> kwarg:</p>
<pre><code>from rest_framework.views import APIView
from rest_framework.schemas import AutoSchema
class CustomView(APIView):
...
schema = AutoSchema(
manual_fields=[
coreapi.Field("extra_field", ...),
]
)
</code></pre>
<p>This allows extension for the most common case without subclassing.</p>
</li>
<li>
<p>Provide an <code>AutoSchema</code> subclass with more complex customisation:</p>
<pre><code>from rest_framework.views import APIView
from rest_framework.schemas import AutoSchema
class CustomSchema(AutoSchema):
def get_link(...):
# Implement custom introspection here (or in other sub-methods)
class CustomView(APIView):
...
schema = CustomSchema()
</code></pre>
<p>This provides complete control over view introspection.</p>
</li>
<li>
<p>Instantiate <code>ManualSchema</code> on your view, providing the Core API <code>Fields</code> for
the view explicitly:</p>
<pre><code>from rest_framework.views import APIView
from rest_framework.schemas import ManualSchema
class CustomView(APIView):
...
schema = ManualSchema(fields=[
coreapi.Field(
"first_field",
required=True,
location="path",
schema=coreschema.String()
),
coreapi.Field(
"second_field",
required=True,
location="path",
schema=coreschema.String()
),
])
</code></pre>
<p>This allows manually specifying the schema for some views whilst maintaining
automatic generation elsewhere.</p>
</li>
</ul>
<p>You may disable schema generation for a view by setting <code>schema</code> to <code>None</code>:</p>
<pre><code> class CustomView(APIView):
...
schema = None # Will not appear in schema
</code></pre>
<hr />
<p><strong>Note</strong>: For full details on <code>SchemaGenerator</code> plus the <code>AutoSchema</code> and
<code>ManualSchema</code> descriptors see the <a href="#api-reference">API Reference below</a>.</p>
<hr />
<h1 id="adding-a-schema-view"><a class="toclink" href="#adding-a-schema-view">Adding a schema view</a></h1>
<p>There are a few different ways to add a schema view to your API, depending on
exactly what you need.</p>
<h2 id="the-get_schema_view-shortcut"><a class="toclink" href="#the-get_schema_view-shortcut">The get_schema_view shortcut</a></h2>
<p>The simplest way to include a schema in your project is to use the
<code>get_schema_view()</code> function.</p>
@ -629,6 +780,12 @@ schema_view = get_schema_view(
<h4 id="generator_class"><a class="toclink" href="#generator_class"><code>generator_class</code></a></h4>
<p>May be used to specify a <code>SchemaGenerator</code> subclass to be passed to the
<code>SchemaView</code>.</p>
<h4 id="authentication_classes"><a class="toclink" href="#authentication_classes"><code>authentication_classes</code></a></h4>
<p>May be used to specify the list of authentication classes that will apply to the schema endpoint.
Defaults to <code>settings.DEFAULT_AUTHENTICATION_CLASSES</code></p>
<h4 id="permission_classes"><a class="toclink" href="#permission_classes"><code>permission_classes</code></a></h4>
<p>May be used to specify the list of permission classes that will apply to the schema endpoint.
Defaults to <code>settings.DEFAULT_PERMISSION_CLASSES</code></p>
<h2 id="using-an-explicit-schema-view"><a class="toclink" href="#using-an-explicit-schema-view">Using an explicit schema view</a></h2>
<p>If you need a little more control than the <code>get_schema_view()</code> shortcut gives you,
then you can use the <code>SchemaGenerator</code> class directly to auto-generate the
@ -754,30 +911,10 @@ populate descriptions in the schema document.</p>
serializer_class = UserSerializer
</code></pre>
<hr />
<h1 id="alternate-schema-formats"><a class="toclink" href="#alternate-schema-formats">Alternate schema formats</a></h1>
<p>In order to support an alternate schema format, you need to implement a custom renderer
class that handles converting a <code>Document</code> instance into a bytestring representation.</p>
<p>If there is a Core API codec package that supports encoding into the format you
want to use then implementing the renderer class can be done by using the codec.</p>
<h2 id="example"><a class="toclink" href="#example">Example</a></h2>
<p>For example, the <code>openapi_codec</code> package provides support for encoding or decoding
to the Open API ("Swagger") format:</p>
<pre><code>from rest_framework import renderers
from openapi_codec import OpenAPICodec
class SwaggerRenderer(renderers.BaseRenderer):
media_type = 'application/openapi+json'
format = 'swagger'
def render(self, data, media_type=None, renderer_context=None):
codec = OpenAPICodec()
return codec.dump(data)
</code></pre>
<hr />
<h1 id="api-reference"><a class="toclink" href="#api-reference">API Reference</a></h1>
<h2 id="schemagenerator"><a class="toclink" href="#schemagenerator">SchemaGenerator</a></h2>
<p>A class that deals with introspecting your API views, which can be used to
generate a schema.</p>
<p>A class that walks a list of routed URL patterns, requests the schema for each view,
and collates the resulting CoreAPI Document.</p>
<p>Typically you'll instantiate <code>SchemaGenerator</code> with a single argument, like so:</p>
<pre><code>generator = SchemaGenerator(title='Stock Prices API')
</code></pre>
@ -802,24 +939,79 @@ permissions to the resulting schema generation.</p>
<p>Return a nested dictionary containing all the links that should be included in the API schema.</p>
<p>This is a good point to override if you want to modify the resulting structure of the generated schema,
as you can build a new dictionary with a different layout.</p>
<h3 id="get_linkself-path-method-view"><a class="toclink" href="#get_linkself-path-method-view">get_link(self, path, method, view)</a></h3>
<h2 id="autoschema"><a class="toclink" href="#autoschema">AutoSchema</a></h2>
<p>A class that deals with introspection of individual views for schema generation.</p>
<p><code>AutoSchema</code> is attached to <code>APIView</code> via the <code>schema</code> attribute.</p>
<p>The <code>AutoSchema</code> constructor takes a single keyword argument <code>manual_fields</code>.</p>
<p><strong><code>manual_fields</code></strong>: a <code>list</code> of <code>coreapi.Field</code> instances that will be added to
the generated fields. Generated fields with a matching <code>name</code> will be overwritten.</p>
<pre><code>class CustomView(APIView):
schema = AutoSchema(manual_fields=[
coreapi.Field(
"my_extra_field",
required=True,
location="path",
schema=coreschema.String()
),
])
</code></pre>
<p>For more advanced customisation subclass <code>AutoSchema</code> to customise schema generation.</p>
<pre><code>class CustomViewSchema(AutoSchema):
"""
Overrides `get_link()` to provide Custom Behavior X
"""
def get_link(self, path, method, base_url):
link = super().get_link(path, method, base_url)
# Do something to customize link here...
return link
class MyView(APIView):
schema = CustomViewSchema()
</code></pre>
<p>The following methods are available to override.</p>
<h3 id="get_linkself-path-method-base_url"><a class="toclink" href="#get_linkself-path-method-base_url">get_link(self, path, method, base_url)</a></h3>
<p>Returns a <code>coreapi.Link</code> instance corresponding to the given view.</p>
<p>You can override this if you need to provide custom behaviors for particular views.</p>
<h3 id="get_descriptionself-path-method-view"><a class="toclink" href="#get_descriptionself-path-method-view">get_description(self, path, method, view)</a></h3>
<p>This is the main entry point.
You can override this if you need to provide custom behaviors for particular views.</p>
<h3 id="get_descriptionself-path-method"><a class="toclink" href="#get_descriptionself-path-method">get_description(self, path, method)</a></h3>
<p>Returns a string to use as the link description. By default this is based on the
view docstring as described in the "Schemas as Documentation" section above.</p>
<h3 id="get_encodingself-path-method-view"><a class="toclink" href="#get_encodingself-path-method-view">get_encoding(self, path, method, view)</a></h3>
<h3 id="get_encodingself-path-method"><a class="toclink" href="#get_encodingself-path-method">get_encoding(self, path, method)</a></h3>
<p>Returns a string to indicate the encoding for any request body, when interacting
with the given view. Eg. <code>'application/json'</code>. May return a blank string for views
that do not expect a request body.</p>
<h3 id="get_path_fieldsself-path-method-view"><a class="toclink" href="#get_path_fieldsself-path-method-view">get_path_fields(self, path, method, view):</a></h3>
<h3 id="get_path_fieldsself-path-method"><a class="toclink" href="#get_path_fieldsself-path-method">get_path_fields(self, path, method):</a></h3>
<p>Return a list of <code>coreapi.Link()</code> instances. One for each path parameter in the URL.</p>
<h3 id="get_serializer_fieldsself-path-method-view"><a class="toclink" href="#get_serializer_fieldsself-path-method-view">get_serializer_fields(self, path, method, view)</a></h3>
<h3 id="get_serializer_fieldsself-path-method"><a class="toclink" href="#get_serializer_fieldsself-path-method">get_serializer_fields(self, path, method)</a></h3>
<p>Return a list of <code>coreapi.Link()</code> instances. One for each field in the serializer class used by the view.</p>
<h3 id="get_pagination_fieldsself-path-method-view"><a class="toclink" href="#get_pagination_fieldsself-path-method-view">get_pagination_fields(self, path, method, view</a></h3>
<h3 id="get_pagination_fieldsself-path-method"><a class="toclink" href="#get_pagination_fieldsself-path-method">get_pagination_fields(self, path, method)</a></h3>
<p>Return a list of <code>coreapi.Link()</code> instances, as returned by the <code>get_schema_fields()</code> method on any pagination class used by the view.</p>
<h3 id="get_filter_fieldsself-path-method-view"><a class="toclink" href="#get_filter_fieldsself-path-method-view">get_filter_fields(self, path, method, view)</a></h3>
<h3 id="get_filter_fieldsself-path-method"><a class="toclink" href="#get_filter_fieldsself-path-method">get_filter_fields(self, path, method)</a></h3>
<p>Return a list of <code>coreapi.Link()</code> instances, as returned by the <code>get_schema_fields()</code> method of any filter classes used by the view.</p>
<h2 id="manualschema"><a class="toclink" href="#manualschema">ManualSchema</a></h2>
<p>Allows manually providing a list of <code>coreapi.Field</code> instances for the schema,
plus an optional description.</p>
<pre><code>class MyView(APIView):
schema = ManualSchema(fields=[
coreapi.Field(
"first_field",
required=True,
location="path",
schema=coreschema.String()
),
coreapi.Field(
"second_field",
required=True,
location="path",
schema=coreschema.String()
),
]
)
</code></pre>
<p>The <code>ManualSchema</code> constructor takes two arguments:</p>
<p><strong><code>fields</code></strong>: A list of <code>coreapi.Field</code> instances. Required.</p>
<p><strong><code>description</code></strong>: A string description. Optional.</p>
<hr />
<h2 id="core-api"><a class="toclink" href="#core-api">Core API</a></h2>
<p>This documentation gives a brief overview of the components within the <code>coreapi</code>
@ -898,6 +1090,11 @@ only if one or more <code>location="form"</code> fields is included on the <code
Valid only if a <code>location="body"</code> field is included on the <code>Link</code>.</p>
<h4 id="description_1"><a class="toclink" href="#description_1"><code>description</code></a></h4>
<p>A short description of the meaning and intended usage of the input field.</p>
<hr />
<h1 id="third-party-packages"><a class="toclink" href="#third-party-packages">Third party packages</a></h1>
<h2 id="drf-openapi"><a class="toclink" href="#drf-openapi">DRF OpenAPI</a></h2>
<p><a href="https://github.com/limdauto/drf_openapi">DRF OpenAPI</a> renders the schema generated by Django Rest Framework
in <a href="https://openapis.org/">OpenAPI</a> format.</p>
</div> <!--/span-->

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -1380,7 +1384,7 @@ def all_high_scores(request):
<hr />
<h1 id="advanced-serializer-usage"><a class="toclink" href="#advanced-serializer-usage">Advanced serializer usage</a></h1>
<h2 id="overriding-serialization-and-deserialization-behavior"><a class="toclink" href="#overriding-serialization-and-deserialization-behavior">Overriding serialization and deserialization behavior</a></h2>
<p>If you need to alter the serialization, deserialization or validation of a serializer class you can do so by overriding the <code>.to_representation()</code> or <code>.to_internal_value()</code> methods.</p>
<p>If you need to alter the serialization or deserialization behavior of a serializer class, you can do so by overriding the <code>.to_representation()</code> or <code>.to_internal_value()</code> methods.</p>
<p>Some reasons this might be useful include...</p>
<ul>
<li>Adding new behavior for new serializer base classes.</li>
@ -1392,7 +1396,7 @@ def all_high_scores(request):
<p>Takes the object instance that requires serialization, and should return a primitive representation. Typically this means returning a structure of built-in Python datatypes. The exact types that can be handled will depend on the render classes you have configured for your API.</p>
<h4 id="to_internal_valueself-data"><a class="toclink" href="#to_internal_valueself-data"><code>.to_internal_value(self, data)</code></a></h4>
<p>Takes the unvalidated incoming data as input and should return the validated data that will be made available as <code>serializer.validated_data</code>. The return value will also be passed to the <code>.create()</code> or <code>.update()</code> methods if <code>.save()</code> is called on the serializer class.</p>
<p>If any of the validation fails, then the method should raise a <code>serializers.ValidationError(errors)</code>. Typically the <code>errors</code> argument here will be a dictionary mapping field names to error messages.</p>
<p>If any of the validation fails, then the method should raise a <code>serializers.ValidationError(errors)</code>. The <code>errors</code> argument should be a dictionary mapping field names (or <code>settings.NON_FIELD_ERRORS_KEY</code>) to a list of error messages. If you don't need to alter deserialization behavior and instead want to provide object-level validation, it's recommended that you intead override the <a href="#object-level-validation"><code>.validate()</code></a> method.</p>
<p>The <code>data</code> argument passed to this method will normally be the value of <code>request.data</code>, so the datatype it provides will depend on the parser classes you have configured for your API.</p>
<h2 id="serializer-inheritance"><a class="toclink" href="#serializer-inheritance">Serializer Inheritance</a></h2>
<p>Similar to Django forms, you can extend and reuse serializers through inheritance. This allows you to declare a common set of fields or methods on a parent class that can then be used in a number of serializers. For example,</p>
@ -1495,9 +1499,9 @@ blacklisted and child serializers can be optionally expanded.</p>
<h2 id="drf-base64"><a class="toclink" href="#drf-base64">DRF-Base64</a></h2>
<p><a href="https://bitbucket.org/levit_scs/drf_base64">DRF-Base64</a> provides a set of field and model serializers that handles the upload of base64-encoded files.</p>
<h2 id="queryfields"><a class="toclink" href="#queryfields">QueryFields</a></h2>
<p><a href="http://djangorestframework-queryfields.readthedocs.io/">djangorestframework-queryfields</a> allows API clients to specify which fields will be sent in the response via inclusion/exclusion query parameters. </p>
<p><a href="http://djangorestframework-queryfields.readthedocs.io/">djangorestframework-queryfields</a> allows API clients to specify which fields will be sent in the response via inclusion/exclusion query parameters.</p>
<h2 id="drf-writable-nested"><a class="toclink" href="#drf-writable-nested">DRF Writable Nested</a></h2>
<p>The <a href="http://github.com/Brogency/drf-writable-nested">drf-writable-nested</a> package provides writable nested model serializer which allows to create/update models with nested related data.</p>
<p>The <a href="http://github.com/beda-software/drf-writable-nested">drf-writable-nested</a> package provides writable nested model serializer which allows to create/update models with nested related data.</p>
</div> <!--/span-->

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -672,6 +676,10 @@ internally in the codebase.</p>
</code></pre>
<p>The default style is to return minified responses, in line with <a href="https://github.com/interagent/http-api-design#keep-json-minified-in-all-responses">Heroku's API design guidelines</a>.</p>
<p>Default: <code>True</code></p>
<h4 id="strict_json"><a class="toclink" href="#strict_json">STRICT_JSON</a></h4>
<p>When set to <code>True</code>, JSON rendering and parsing will only observe syntactically valid JSON, raising an exception for the extended float values (<code>nan</code>, <code>inf</code>, <code>-inf</code>) accepted by Python's <code>json</code> module. This is the recommended setting, as these values are not generally supported. e.g., neither Javascript's <code>JSON.Parse</code> nor PostgreSQL's JSON data type accept these values.</p>
<p>When set to <code>False</code>, JSON rendering and parsing will be permissive. However, these values are still invalid and will need to be specially handled in your code.</p>
<p>Default: <code>True</code></p>
<h4 id="coerce_decimal_to_string"><a class="toclink" href="#coerce_decimal_to_string">COERCE_DECIMAL_TO_STRING</a></h4>
<p>When returning decimal objects in API representations that do not support a native decimal type, it is normally best to return the value as a string. This avoids the loss of precision that occurs with binary floating point implementations.</p>
<p>When set to <code>True</code>, the serializer <code>DecimalField</code> class will return strings instead of <code>Decimal</code> objects. When set to <code>False</code>, serializers will return <code>Decimal</code> objects, which the default JSON encoder will return as floats.</p>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -432,7 +436,7 @@
<p>418 I'm a teapot - Any attempt to brew coffee with a teapot should result in the error code "418 I'm a teapot". The resulting entity body MAY be short and stout.</p>
<p>&mdash; <a href="http://www.ietf.org/rfc/rfc2324.txt">RFC 2324</a>, Hyper Text Coffee Pot Control Protocol</p>
</blockquote>
<p>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.</p>
<p>Using bare status codes in your responses isn't recommended. REST framework includes a set of named constants that you can use to make your code more obvious and readable.</p>
<pre><code>from rest_framework import status
from rest_framework.response import Response

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -573,6 +577,8 @@ request = factory.get('/accounts/django-superstars/')
force_authenticate(request, user=user, token=user.auth_token)
</code></pre>
<hr />
<p><strong>Note</strong>: <code>force_authenticate</code> directly sets <code>request.user</code> to the in-memory <code>user</code> instance. If you are re-using the same <code>user</code> instance across multiple tests that update the saved <code>user</code> state, you may need to call <a href="https://docs.djangoproject.com/en/1.11/ref/models/instances/#django.db.models.Model.refresh_from_db"><code>refresh_from_db()</code></a> between tests.</p>
<hr />
<p><strong>Note</strong>: When using <code>APIRequestFactory</code>, the object that is returned is Django's standard <code>HttpRequest</code>, and not REST framework's <code>Request</code> object, which is only generated once the view is called.</p>
<p>This means that setting attributes directly on the request object may not always have the effect you expect. For example, setting <code>.token</code> directly will have no effect, and setting <code>.user</code> directly will only work if session authentication is being used.</p>
<pre><code># Request will only authenticate if `SessionAuthentication` is in use.

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -500,8 +504,8 @@ def example_view(request, format=None):
return Response(content)
</code></pre>
<h2 id="how-clients-are-identified"><a class="toclink" href="#how-clients-are-identified">How clients are identified</a></h2>
<p>The <code>X-Forwarded-For</code> and <code>Remote-Addr</code> HTTP headers are used to uniquely identify client IP addresses for throttling. If the <code>X-Forwarded-For</code> header is present then it will be used, otherwise the value of the <code>Remote-Addr</code> header will be used.</p>
<p>If you need to strictly identify unique client IP addresses, you'll need to first configure the number of application proxies that the API runs behind by setting the <code>NUM_PROXIES</code> setting. This setting should be an integer of zero or more. If set to non-zero then the client IP will be identified as being the last IP address in the <code>X-Forwarded-For</code> header, once any application proxy IP addresses have first been excluded. If set to zero, then the <code>Remote-Addr</code> header will always be used as the identifying IP address.</p>
<p>The <code>X-Forwarded-For</code> HTTP header and <code>REMOTE_ADDR</code> WSGI variable are used to uniquely identify client IP addresses for throttling. If the <code>X-Forwarded-For</code> header is present then it will be used, otherwise the value of the <code>REMOTE_ADDR</code> variable from the WSGI environment will be used.</p>
<p>If you need to strictly identify unique client IP addresses, you'll need to first configure the number of application proxies that the API runs behind by setting the <code>NUM_PROXIES</code> setting. This setting should be an integer of zero or more. If set to non-zero then the client IP will be identified as being the last IP address in the <code>X-Forwarded-For</code> header, once any application proxy IP addresses have first been excluded. If set to zero, then the <code>REMOTE_ADDR</code> value will always be used as the identifying IP address.</p>
<p>It is important to understand that if you configure the <code>NUM_PROXIES</code> setting, then all clients behind a unique <a href="http://en.wikipedia.org/wiki/Network_address_translation">NAT'd</a> gateway will be treated as a single client.</p>
<p>Further context on how the <code>X-Forwarded-For</code> header works, and identifying a remote client IP can be <a href="http://oxpedia.org/wiki/index.php?title=AppSuite:Grizzly#Multiple_Proxies_in_front_of_the_cluster">found here</a>.</p>
<h2 id="setting-up-the-cache"><a class="toclink" href="#setting-up-the-cache">Setting up the cache</a></h2>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -412,6 +416,10 @@
<a href="#api-policy-decorators">API policy decorators</a>
</li>
<li>
<a href="#view-schema-decorator">View schema decorator</a>
</li>
<div class="promo">
@ -521,7 +529,7 @@ This method is used to enforce permissions and throttling, and perform content n
</blockquote>
<p>REST framework also allows you to work with regular function based views. It provides a set of simple decorators that wrap your function based views to ensure they receive an instance of <code>Request</code> (rather than the usual Django <code>HttpRequest</code>) and allows them to return a <code>Response</code> (instead of a Django <code>HttpResponse</code>), and allow you to configure how the request is processed.</p>
<h2 id="api_view"><a class="toclink" href="#api_view">@api_view()</a></h2>
<p><strong>Signature:</strong> <code>@api_view(http_method_names=['GET'], exclude_from_schema=False)</code></p>
<p><strong>Signature:</strong> <code>@api_view(http_method_names=['GET'])</code></p>
<p>The core of this functionality is the <code>api_view</code> decorator, which takes a list of HTTP methods that your view should respond to. For example, this is how you would write a very simple view that just manually returns some data:</p>
<pre><code>from rest_framework.decorators import api_view
@ -537,12 +545,6 @@ def hello_world(request):
return Response({"message": "Got some data!", "data": request.data})
return Response({"message": "Hello, world!"})
</code></pre>
<p>You can also mark an API view as being omitted from any <a href="../schemas/">auto-generated schema</a>,
using the <code>exclude_from_schema</code> argument.:</p>
<pre><code>@api_view(['GET'], exclude_from_schema=True)
def api_docs(request):
...
</code></pre>
<h2 id="api-policy-decorators"><a class="toclink" href="#api-policy-decorators">API policy decorators</a></h2>
<p>To override the default settings, REST framework provides a set of additional decorators which can be added to your views. These must come <em>after</em> (below) the <code>@api_view</code> decorator. For example, to create a view that uses a <a href="../throttling/">throttle</a> to ensure it can only be called once per day by a particular user, use the <code>@throttle_classes</code> decorator, passing a list of throttle classes:</p>
<pre><code>from rest_framework.decorators import api_view, throttle_classes
@ -566,6 +568,30 @@ def view(request):
<li><code>@permission_classes(...)</code></li>
</ul>
<p>Each of these decorators takes a single argument which must be a list or tuple of classes.</p>
<h2 id="view-schema-decorator"><a class="toclink" href="#view-schema-decorator">View schema decorator</a></h2>
<p>To override the default schema generation for function based views you may use
the <code>@schema</code> decorator. This must come <em>after</em> (below) the <code>@api_view</code>
decorator. For example:</p>
<pre><code>from rest_framework.decorators import api_view, schema
from rest_framework.schemas import AutoSchema
class CustomAutoSchema(AutoSchema):
def get_link(self, path, method, base_url):
# override view introspection here...
@api_view(['GET'])
@schema(CustomAutoSchema())
def view(request):
return Response({"message": "Hello for today! See you tomorrow!"})
</code></pre>
<p>This decorator takes a single <code>AutoSchema</code> instance, an <code>AutoSchema</code> subclass
instance or <code>ManualSchema</code> instance as described in the <a href="../schemas/">Schemas documentation</a>.
You may pass <code>None</code> in order to exclude the view from schema generation.</p>
<pre><code>@api_view(['GET'])
@schema(None)
def view(request):
return Response({"message": "Will not appear in schema!"})
</code></pre>
</div> <!--/span-->

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

BIN
img/bayer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
img/drf-openapi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -318,6 +318,10 @@
<a href="topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -546,7 +550,7 @@ continued development by <strong><a href="topics/funding/">signing up for a paid
<p>REST framework requires the following:</p>
<ul>
<li>Python (2.7, 3.2, 3.3, 3.4, 3.5, 3.6)</li>
<li>Django (1.8, 1.9, 1.10, 1.11)</li>
<li>Django (1.10, 1.11, 2.0 alpha)</li>
</ul>
<p>The following packages are optional:</p>
<ul>
@ -687,6 +691,7 @@ urlpatterns = [
<li><a href="topics/3.4-announcement/">3.4 Announcement</a></li>
<li><a href="topics/3.5-announcement/">3.5 Announcement</a></li>
<li><a href="topics/3.6-announcement/">3.6 Announcement</a></li>
<li><a href="topics/3.7-announcement/">3.7 Announcement</a></li>
<li><a href="topics/kickstarter-announcement/">Kickstarter Announcement</a></li>
<li><a href="topics/mozilla-grant/">Mozilla Grant</a></li>
<li><a href="topics/funding/">Funding</a></li>

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
<url>
<loc>http://www.django-rest-framework.org//</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
@ -13,49 +13,49 @@
<url>
<loc>http://www.django-rest-framework.org//tutorial/quickstart/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//tutorial/1-serialization/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//tutorial/2-requests-and-responses/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//tutorial/3-class-based-views/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//tutorial/4-authentication-and-permissions/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//tutorial/5-relationships-and-hyperlinked-apis/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//tutorial/6-viewsets-and-routers/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//tutorial/7-schemas-and-client-libraries/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
@ -65,163 +65,163 @@
<url>
<loc>http://www.django-rest-framework.org//api-guide/requests/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/responses/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/views/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/generic-views/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/viewsets/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/routers/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/parsers/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/renderers/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/serializers/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/fields/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/relations/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/validators/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/authentication/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/permissions/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/throttling/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/filtering/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/pagination/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/versioning/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/content-negotiation/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/metadata/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/schemas/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/format-suffixes/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/reverse/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/exceptions/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/status-codes/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/testing/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/settings/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
@ -231,145 +231,151 @@
<url>
<loc>http://www.django-rest-framework.org//topics/documenting-your-api/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/api-clients/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/internationalization/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/ajax-csrf-cors/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/html-and-forms/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/browser-enhancements/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/browsable-api/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/rest-hypermedia-hateoas/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/third-party-packages/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/tutorials-and-resources/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/contributing/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/project-management/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/jobs/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/3.0-announcement/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/3.1-announcement/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/3.2-announcement/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/3.3-announcement/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/3.4-announcement/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/3.5-announcement/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/3.6-announcement/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/3.7-announcement/</loc>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/kickstarter-announcement/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/mozilla-grant/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/funding/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/release-notes/</loc>
<lastmod>2017-08-22</lastmod>
<lastmod>2017-10-06</lastmod>
<changefreq>daily</changefreq>
</url>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -58,7 +58,7 @@
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../kickstarter-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.7-announcement/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.5-announcement/">
@ -318,6 +318,10 @@
<a href="./">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -0,0 +1,565 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>3.7 Announcement - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/3.7-announcement/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 3.7 Announcement">
<meta name="author" content="Tom Christie">
<!-- Le styles -->
<link href="../../css/prettify.css" rel="stylesheet">
<link href="../../css/bootstrap.css" rel="stylesheet">
<link href="../../css/bootstrap-responsive.css" rel="stylesheet">
<link href="../../css/default.css" rel="stylesheet">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-18852272-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
<style>
#sidebarInclude img {
margin-bottom: 10px;
}
#sidebarInclude a.promo {
color: black;
}
@media (max-width: 767px) {
div.promo {
display: none;
}
}
</style>
</head>
<body onload="prettyPrint()" class="-page">
<div class="wrapper">
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../kickstarter-announcement/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.6-announcement/">
<i class="icon-arrow-left icon-white"></i> Previous
</a>
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
<ul class="nav navbar-nav">
<li >
<a href="../..">Home</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../tutorial/quickstart/">Quickstart</a>
</li>
<li >
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
</li>
<li >
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
</li>
<li >
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
</li>
<li >
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
</li>
<li >
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
</li>
<li >
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
</li>
<li >
<a href="../../tutorial/7-schemas-and-client-libraries/">7 - Schemas and client libraries</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">API Guide <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../api-guide/requests/">Requests</a>
</li>
<li >
<a href="../../api-guide/responses/">Responses</a>
</li>
<li >
<a href="../../api-guide/views/">Views</a>
</li>
<li >
<a href="../../api-guide/generic-views/">Generic views</a>
</li>
<li >
<a href="../../api-guide/viewsets/">Viewsets</a>
</li>
<li >
<a href="../../api-guide/routers/">Routers</a>
</li>
<li >
<a href="../../api-guide/parsers/">Parsers</a>
</li>
<li >
<a href="../../api-guide/renderers/">Renderers</a>
</li>
<li >
<a href="../../api-guide/serializers/">Serializers</a>
</li>
<li >
<a href="../../api-guide/fields/">Serializer fields</a>
</li>
<li >
<a href="../../api-guide/relations/">Serializer relations</a>
</li>
<li >
<a href="../../api-guide/validators/">Validators</a>
</li>
<li >
<a href="../../api-guide/authentication/">Authentication</a>
</li>
<li >
<a href="../../api-guide/permissions/">Permissions</a>
</li>
<li >
<a href="../../api-guide/throttling/">Throttling</a>
</li>
<li >
<a href="../../api-guide/filtering/">Filtering</a>
</li>
<li >
<a href="../../api-guide/pagination/">Pagination</a>
</li>
<li >
<a href="../../api-guide/versioning/">Versioning</a>
</li>
<li >
<a href="../../api-guide/content-negotiation/">Content negotiation</a>
</li>
<li >
<a href="../../api-guide/metadata/">Metadata</a>
</li>
<li >
<a href="../../api-guide/schemas/">Schemas</a>
</li>
<li >
<a href="../../api-guide/format-suffixes/">Format suffixes</a>
</li>
<li >
<a href="../../api-guide/reverse/">Returning URLs</a>
</li>
<li >
<a href="../../api-guide/exceptions/">Exceptions</a>
</li>
<li >
<a href="../../api-guide/status-codes/">Status codes</a>
</li>
<li >
<a href="../../api-guide/testing/">Testing</a>
</li>
<li >
<a href="../../api-guide/settings/">Settings</a>
</li>
</ul>
</li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
<li >
<a href="../third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../project-management/">Project management</a>
</li>
<li >
<a href="../jobs/">Jobs</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li class="active" >
<a href="./">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../funding/">Funding</a>
</li>
<li >
<a href="../release-notes/">Release Notes</a>
</li>
</ul>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
</div>
<div class="body-content">
<div class="container-fluid">
<!-- Search Modal -->
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3 id="myModalLabel">Documentation search</h3>
</div>
<div class="modal-body">
<form role="form" autocomplete="off">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
</div>
</form>
<div id="mkdocs-search-results"></div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
<div class="row-fluid">
<div class="span3">
<div id="table-of-contents">
<ul class="nav nav-list side-nav well sidebar-nav-fixed">
<li class="main">
<a href="#django-rest-framework-37">Django REST framework 3.7</a>
</li>
<li>
<a href="#funding">Funding</a>
</li>
<li>
<a href="#customizing-api-docs-schema-generation">Customizing API docs &amp; schema generation.</a>
</li>
<li>
<a href="#django-20-support">Django 2.0 support</a>
</li>
<li>
<a href="#minor-fixes-and-improvements">Minor fixes and improvements</a>
</li>
<li>
<a href="#deprecations">Deprecations</a>
</li>
<li>
<a href="#whats-next">What's next</a>
</li>
<div class="promo">
<hr/>
<div id="sidebarInclude">
</div>
</ul>
</div>
</div>
<div id="main-content" class="span9">
<style>
.promo li a {
float: left;
width: 130px;
height: 20px;
text-align: center;
margin: 10px 30px;
padding: 150px 0 0 0;
background-position: 0 50%;
background-size: 130px auto;
background-repeat: no-repeat;
font-size: 120%;
color: black;
}
.promo li {
list-style: none;
}
</style>
<h1 id="django-rest-framework-37"><a class="toclink" href="#django-rest-framework-37">Django REST framework 3.7</a></h1>
<p>The 3.7 release focuses on improvements to schema generation and the interactive API documentation.</p>
<p>This release has been made possible by <a href="https://www.bayer.com/">Bayer</a> who have sponsored the release.</p>
<p><a href="https://www.bayer.com/"><img src="/img/bayer.png"/></a></p>
<hr />
<h2 id="funding"><a class="toclink" href="#funding">Funding</a></h2>
<p>If you use REST framework commercially and would like to see this work continue, we strongly encourage you to invest in its continued development by
<strong><a href="../funding/">signing up for a paid&nbsp;plan</a></strong>.</p>
<ul class="premium-promo promo">
<li><a href="http://jobs.rover.com/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)">Rover.com</a></li>
<li><a href="https://getsentry.com/welcome/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)">Sentry</a></li>
<li><a href="https://getstream.io/try-the-api/?utm_source=drf&utm_medium=banner&utm_campaign=drf" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/stream-130.png)">Stream</a></li>
<li><a href="https://hello.machinalis.co.uk/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/Machinalis130.png)">Machinalis</a></li>
<li><a href="https://rollbar.com" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rollbar.png)">Rollbar</a></li>
</ul>
<div style="clear: both; padding-bottom: 20px;"></div>
<p><em>As well as our release sponsor, we'd like to say thanks in particular our premium backers, <a href="http://jobs.rover.com/">Rover</a>, <a href="https://getsentry.com/welcome/">Sentry</a>, <a href="https://getstream.io/?utm_source=drf&amp;utm_medium=banner&amp;utm_campaign=drf">Stream</a>, <a href="https://hello.machinalis.co.uk/">Machinalis</a>, and <a href="https://rollbar.com">Rollbar</a>.</em></p>
<hr />
<h2 id="customizing-api-docs-schema-generation"><a class="toclink" href="#customizing-api-docs-schema-generation">Customizing API docs &amp; schema generation.</a></h2>
<p>The schema generation introduced in 3.5 and the related API docs generation in 3.6 are both hugely powerful features, however they've been somewhat limited in cases where the view introspection isn't able to correctly identify the schema for a particular view.</p>
<p>In order to try to address this we're now adding the ability for per-view customization of the API schema. The interface that we're adding for this allows either basic manual overrides over which fields should be included on a view, or for more complex programmatic overriding of the schema generation. We believe this release comprehensively addresses some of the existing shortcomings of the schema features.</p>
<p>Let's take a quick look at using the new functionality...</p>
<p>The <code>APIView</code> class has a <code>schema</code> attribute, that is used to control how the Schema for that particular view is generated. The default behaviour is to use the <code>AutoSchema</code> class.</p>
<pre><code>from rest_framework.views import APIView
from rest_framework.schemas import AutoSchema
class CustomView(APIView):
schema = AutoSchema() # Included for demonstration only. This is the default behavior.
</code></pre>
<p>We can remove a view from the API schema and docs, like so:</p>
<pre><code>class CustomView(APIView):
schema = None
</code></pre>
<p>If we want to mostly use the default behavior, but additionally include some additional fields on a particular view, we can now do so easily...</p>
<pre><code>class CustomView(APIView):
schema = AutoSchema(manual_fields=[
coreapi.Field('search', location='query')
])
</code></pre>
<p>To ignore the automatic generation for a particular view, and instead specify the schema explicitly, we use the <code>ManualSchema</code> class instead...</p>
<pre><code>class CustomView(APIView):
schema = ManualSchema(fields=[...])
</code></pre>
<p>For more advanced behaviors you can subclass <code>AutoSchema</code> to provide for customized schema generation, and apply that to particular views.</p>
<pre><code>class CustomView(APIView):
schema = CustomizedSchemaGeneration()
</code></pre>
<p>For full details on the new functionality, please see the <a href="../../api-guide/schemas/">Schema Documentation</a>.</p>
<hr />
<h2 id="django-20-support"><a class="toclink" href="#django-20-support">Django 2.0 support</a></h2>
<p>REST framework 3.7 supports Django versions 1.10, 1.11, and 2.0 alpha.</p>
<hr />
<h2 id="minor-fixes-and-improvements"><a class="toclink" href="#minor-fixes-and-improvements">Minor fixes and improvements</a></h2>
<p>There are a large number of minor fixes and improvements in this release. See the <a href="../release-notes/">release notes</a> page for a complete listing.</p>
<p>The number of <a href="https://github.com/encode/django-rest-framework/issues">open tickets against the project</a> currently at its lowest number in quite some time, and we're continuing to focus on reducing these to a manageable amount.</p>
<hr />
<h2 id="deprecations"><a class="toclink" href="#deprecations">Deprecations</a></h2>
<h3 id="exclude_from_schema"><a class="toclink" href="#exclude_from_schema"><code>exclude_from_schema</code></a></h3>
<p>Both <code>APIView.exclude_from_schema</code> and the <code>exclude_from_schema</code> argument to the <code>@api_view</code> decorator and now <code>PendingDeprecation</code>. They will be moved to deprecated in the 3.8 release, and removed entirely in 3.9.</p>
<p>For <code>APIView</code> you should instead set a <code>schema = None</code> attribute on the view class.</p>
<p>For function based views the <code>@schema</code> decorator can be used to exclude the view from the schema, by using <code>@schema(None)</code>.</p>
<h3 id="djangofilterbackend"><a class="toclink" href="#djangofilterbackend"><code>DjangoFilterBackend</code></a></h3>
<p>The <code>DjangoFilterBackend</code> was moved to pending deprecation in 3.5, and deprecated in 3.6. It has now been removed from the core framework.</p>
<p>The functionality remains fully available, but is instead provided in the <code>django-filter</code> package.</p>
<hr />
<h2 id="whats-next"><a class="toclink" href="#whats-next">What's next</a></h2>
<p>We're still planning to work on improving real-time support for REST framework by providing documentation on integrating with Django channels, as well adding support for more easily adding WebSocket support to existing HTTP endpoints.</p>
<p>This will likely be timed so that any REST framework development here ties in with similar work on <a href="https://github.com/encode/apistar">API Star</a>.</p>
</div> <!--/span-->
</div> <!--/row-->
</div> <!--/.fluid-container-->
</div> <!--/.body content-->
<div id="push"></div>
</div> <!--/.wrapper -->
<footer class="span12">
<p>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.
</p>
</footer>
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../../js/jquery-1.8.1-min.js"></script>
<script src="../../js/prettify-1.0.js"></script>
<script src="../../js/bootstrap-2.1.1-min.js"></script>
<script src="https://fund.django-rest-framework.org/sidebar_include.js"></script>
<script>var base_url = '../..';</script>
<script src="../../mkdocs/js/require.js"></script>
<script src="../../js/theme.js"></script>
<script>
var shiftWindow = function() {
scrollBy(0, -50)
};
if (location.hash) shiftWindow();
window.addEventListener("hashchange", shiftWindow);
$('.dropdown-menu').on('click touchstart', function(event) {
event.stopPropagation();
});
// Dynamically force sidenav/dropdown to no higher than browser window
$('.side-nav, .dropdown-menu').css('max-height', window.innerHeight - 130);
$(function() {
$(window).resize(function() {
$('.side-nav, .dropdown-menu').css('max-height', window.innerHeight - 130);
});
});
</script>
</body>
</html>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -777,11 +781,11 @@ urlpatterns = [
<pre><code>&lt;!--
Load the CoreAPI library and the API schema.
/static/rest_framework/js/coreapi-0.1.0.js
/static/rest_framework/js/coreapi-0.1.1.js
/docs/schema.js
--&gt;
{% load staticfiles %}
&lt;script src="{% static 'rest_framework/js/coreapi-0.1.0.js' %}"&gt;&lt;/script&gt;
&lt;script src="{% static 'rest_framework/js/coreapi-0.1.1.js' %}"&gt;&lt;/script&gt;
&lt;script src="{% url 'api-docs:schema-js' %}"&gt;&lt;/script&gt;
</code></pre>
<p>The <code>coreapi</code> library, and the <code>schema</code> object will now both be available on the <code>window</code> instance.</p>
@ -798,7 +802,7 @@ instantiating the client.</p>
<p>The <code>SessionAuthentication</code> class allows session cookies to provide the user
authentication. You'll want to provide a standard HTML login flow, to allow
the user to login, and then instantiate a client using session authentication:</p>
<pre><code>let auth = coreapi.auth.SessionAuthentication({
<pre><code>let auth = new coreapi.auth.SessionAuthentication({
csrfCookieName: 'csrftoken',
csrfHeaderName: 'X-CSRFToken'
})
@ -809,7 +813,7 @@ requests for unsafe HTTP methods.</p>
<h4 id="token-authentication_1"><a class="toclink" href="#token-authentication_1">Token authentication</a></h4>
<p>The <code>TokenAuthentication</code> class can be used to support REST framework's built-in
<code>TokenAuthentication</code>, as well as OAuth and JWT schemes.</p>
<pre><code>let auth = coreapi.auth.TokenAuthentication({
<pre><code>let auth = new coreapi.auth.TokenAuthentication({
scheme: 'JWT'
token: '&lt;token&gt;'
})
@ -842,7 +846,7 @@ function loginUser(username, password) {
</code></pre>
<h4 id="basic-authentication_1"><a class="toclink" href="#basic-authentication_1">Basic authentication</a></h4>
<p>The <code>BasicAuthentication</code> class can be used to support HTTP Basic Authentication.</p>
<pre><code>let auth = coreapi.auth.BasicAuthentication({
<pre><code>let auth = new coreapi.auth.BasicAuthentication({
username: '&lt;username&gt;',
password: '&lt;password&gt;'
})

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -443,6 +447,20 @@ urlpatterns = [
<li><code>/docs/</code> - The documentation page itself.</li>
<li><code>/docs/schema.js</code> - A JavaScript resource that exposes the API schema.</li>
</ul>
<hr />
<p><strong>Note</strong>: By default <code>include_docs_urls</code> configures the underlying <code>SchemaView</code> to generate <em>public</em> schemas.
This means that views will not be instantiated with a <code>request</code> instance. i.e. Inside the view <code>self.request</code> will be <code>None</code>.</p>
<p>To be compatible with this behaviour methods (such as <code>get_serializer</code> or <code>get_serializer_class</code> etc.) which inspect <code>self.request</code> or, particularly, <code>self.request.user</code> may need to be adjusted to handle this case.</p>
<p>You may ensure views are given a <code>request</code> instance by calling <code>include_docs_urls</code> with <code>public=False</code>:</p>
<pre><code>from rest_framework.documentation import include_docs_urls
urlpatterns = [
...
# Generate schema with valid `request` instance:
url(r'^docs/', include_docs_urls(title='My API title', public=False))
]
</code></pre>
<hr />
<h3 id="documenting-your-views"><a class="toclink" href="#documenting-your-views">Documenting your views</a></h3>
<p>You can document your views by including docstrings that describe each of the available actions.
For example:</p>
@ -474,9 +492,58 @@ For example:</p>
Create a new user instance.
"""
</code></pre>
<h3 id="documentation-api-reference"><a class="toclink" href="#documentation-api-reference"><code>documentation</code> API Reference</a></h3>
<p>The <code>rest_framework.documentation</code> module provides three helper functions to help configure the interactive API documentation, <code>include_docs_url</code> (usage shown above), <code>get_docs_view</code> and <code>get_schemajs_view</code>.</p>
<p><code>include_docs_url</code> employs <code>get_docs_view</code> and <code>get_schemajs_view</code> to generate the url patterns for the documentation page and JavaScript resource that exposes the API schema respectively. They expose the following options for customisation. (<code>get_docs_view</code> and <code>get_schemajs_view</code> ultimately call <code>rest_frameworks.schemas.get_schema_view()</code>, see the Schemas docs for more options there.)</p>
<h4 id="include_docs_url"><a class="toclink" href="#include_docs_url"><code>include_docs_url</code></a></h4>
<ul>
<li><code>title</code>: Default <code>None</code>. May be used to provide a descriptive title for the schema definition.</li>
<li><code>description</code>: Default <code>None</code>. May be used to provide a description for the schema definition.</li>
<li><code>schema_url</code>: Default <code>None</code>. May be used to pass a canonical base URL for the schema.</li>
<li><code>public</code>: Default <code>True</code>. Should the schema be considered <em>public</em>? If <code>True</code> schema is generated without a <code>request</code> instance being passed to views.</li>
<li><code>patterns</code>: Default <code>None</code>. A list of URLs to inspect when generating the schema. If <code>None</code> project's URL conf will be used.</li>
<li><code>generator_class</code>: Default <code>rest_framework.schemas.SchemaGenerator</code>. May be used to specify a <code>SchemaGenerator</code> subclass to be passed to the <code>SchemaView</code>.</li>
<li><code>authentication_classes</code>: Default <code>api_settings.DEFAULT_AUTHENTICATION_CLASSES</code>. May be used to pass custom authentication classes to the <code>SchemaView</code>.</li>
<li><code>permission_classes</code>: Default <code>api_settings.DEFAULT_PERMISSION_CLASSES</code> May be used to pass custom permission classes to the <code>SchemaView</code>.</li>
</ul>
<h4 id="get_docs_view"><a class="toclink" href="#get_docs_view"><code>get_docs_view</code></a></h4>
<ul>
<li><code>title</code>: Default <code>None</code>. May be used to provide a descriptive title for the schema definition.</li>
<li><code>description</code>: Default <code>None</code>. May be used to provide a description for the schema definition.</li>
<li><code>schema_url</code>: Default <code>None</code>. May be used to pass a canonical base URL for the schema.</li>
<li><code>public</code>: Default <code>True</code>. If <code>True</code> schema is generated without a <code>request</code> instance being passed to views.</li>
<li><code>patterns</code>: Default <code>None</code>. A list of URLs to inspect when generating the schema. If <code>None</code> project's URL conf will be used.</li>
<li><code>generator_class</code>: Default <code>rest_framework.schemas.SchemaGenerator</code>. May be used to specify a <code>SchemaGenerator</code> subclass to be passed to the <code>SchemaView</code>.</li>
<li><code>authentication_classes</code>: Default <code>api_settings.DEFAULT_AUTHENTICATION_CLASSES</code>. May be used to pass custom authentication classes to the <code>SchemaView</code>.</li>
<li><code>permission_classes</code>: Default <code>api_settings.DEFAULT_PERMISSION_CLASSES</code> May be used to pass custom permission classes to the <code>SchemaView</code>.</li>
</ul>
<h4 id="get_schemajs_view"><a class="toclink" href="#get_schemajs_view"><code>get_schemajs_view</code></a></h4>
<ul>
<li><code>title</code>: Default <code>None</code>. May be used to provide a descriptive title for the schema definition.</li>
<li><code>description</code>: Default <code>None</code>. May be used to provide a description for the schema definition.</li>
<li><code>schema_url</code>: Default <code>None</code>. May be used to pass a canonical base URL for the schema.</li>
<li><code>public</code>: Default <code>True</code>. If <code>True</code> schema is generated without a <code>request</code> instance being passed to views.</li>
<li><code>patterns</code>: Default <code>None</code>. A list of URLs to inspect when generating the schema. If <code>None</code> project's URL conf will be used.</li>
<li><code>generator_class</code>: Default <code>rest_framework.schemas.SchemaGenerator</code>. May be used to specify a <code>SchemaGenerator</code> subclass to be passed to the <code>SchemaView</code>.</li>
<li><code>authentication_classes</code>: Default <code>api_settings.DEFAULT_AUTHENTICATION_CLASSES</code>. May be used to pass custom authentication classes to the <code>SchemaView</code>.</li>
<li><code>permission_classes</code>: Default <code>api_settings.DEFAULT_PERMISSION_CLASSES</code> May be used to pass custom permission classes to the <code>SchemaView</code>.</li>
</ul>
<hr />
<h2 id="third-party-packages"><a class="toclink" href="#third-party-packages">Third party packages</a></h2>
<p>There are a number of mature third-party packages for providing API documentation.</p>
<h4 id="drf-openapi"><a class="toclink" href="#drf-openapi">DRF OpenAPI</a></h4>
<p><a href="https://github.com/limdauto/drf_openapi/">DRF OpenAPI</a> bridges the gap between OpenAPI specification and tool chain with the schema exposed
out-of-the-box by Django Rest Framework. Its goals are:</p>
<ul>
<li>To be dropped into any existing DRF project without any code change necessary.</li>
<li>Provide clear disctinction between request schema and response schema.</li>
<li>Provide a versioning mechanism for each schema. Support defining schema by version range syntax, e.g. &gt;1.0, &lt;=2.0</li>
<li>Support multiple response codes, not just 200</li>
<li>All this information should be bound to view methods, not view classes.</li>
</ul>
<p>It also tries to stay current with the maturing schema generation mechanism provided by DRF.</p>
<p><img alt="Screenshot - DRF OpenAPI" src="../../img/drf-openapi.png" /></p>
<hr />
<h4 id="drf-docs"><a class="toclink" href="#drf-docs">DRF Docs</a></h4>
<p><a href="https://github.com/ekonstantinidis/django-rest-framework-docs">DRF Docs</a> allows you to document Web APIs made with Django REST Framework and it is authored by Emmanouil Konstantinidis. It's made to work out of the box and its setup should not take more than a couple of minutes. Complete documentation can be found on the <a href="http://www.drfdocs.com/">website</a> while there is also a <a href="http://demo.drfdocs.com/">demo</a> available for people to see what it looks like. <strong>Live API Endpoints</strong> allow you to utilize the endpoints from within the documentation in a neat way.</p>
<p>Features include customizing the template with your branding, settings for hiding the docs depending on the environment and more.</p>
@ -537,7 +604,7 @@ For example:</p>
[ref]: http://example.com/activating-accounts
"""
</code></pre>
<p>Note that when using viewsets the basic docstring is used for all generated views. To provide descriptions for each view, such as for the the list and retrieve views, use docstring sections as described in <a href="../../api-guide/schemas/#examples">Schemas as documentation: Examples</a>.</p>
<p>Note that when using viewsets the basic docstring is used for all generated views. To provide descriptions for each view, such as for the the list and retrieve views, use docstring sections as described in <a href="../../api-guide/schemas/#example">Schemas as documentation: Examples</a>.</p>
<h4 id="the-options-method"><a class="toclink" href="#the-options-method">The <code>OPTIONS</code> method</a></h4>
<p>REST framework APIs also support programmatically accessible descriptions, using the <code>OPTIONS</code> HTTP method. A view will respond to an <code>OPTIONS</code> request with metadata including the name, description, and the various media types it accepts and responds with.</p>
<p>When using the generic views, any <code>OPTIONS</code> requests will additionally respond with metadata regarding any <code>POST</code> or <code>PUT</code> actions available, describing which fields are on the serializer.</p>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -745,7 +749,7 @@ DRF is one of the core reasons why Django is top choice among web frameworks tod
<p>For further enquires please contact <a href=mailto:funding@django-rest-framework.org>funding@django-rest-framework.org</a>.</p>
<hr />
<h2 id="accountability"><a class="toclink" href="#accountability">Accountability</a></h2>
<p>In an effort to keep the project as transparent as possible, we are releasing <a href="http://www.encode.io/reports/july-2017">monthly progress reports</a> and regularly include financial reports and cost breakdowns.</p>
<p>In an effort to keep the project as transparent as possible, we are releasing <a href="http://www.encode.io/reports/september-2017">monthly progress reports</a> and regularly include financial reports and cost breakdowns.</p>
<!-- Begin MailChimp Signup Form -->
<p><link href="//cdn-images.mailchimp.com/embedcode/classic-10_7.css" rel="stylesheet" type="text/css">

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -61,7 +61,7 @@
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../mozilla-grant/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.6-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.7-announcement/">
<i class="icon-arrow-left icon-white"></i> Previous
</a>
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li class="active" >
<a href="./">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -394,6 +398,10 @@
<a href="#upgrading">Upgrading</a>
</li>
<li>
<a href="#37x-series">3.7.x series</a>
</li>
<li>
<a href="#36x-series">3.6.x series</a>
</li>
@ -469,6 +477,65 @@
<pre><code>pip freeze | grep djangorestframework
</code></pre>
<hr />
<h2 id="37x-series"><a class="toclink" href="#37x-series">3.7.x series</a></h2>
<h3 id="370"><a class="toclink" href="#370">3.7.0</a></h3>
<p><strong>Date</strong>: <a href="https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.7.0+Release%22">6th October 2017</a></p>
<ul>
<li>Fix <code>DjangoModelPermissions</code> to ensure user authentication before calling the view's <code>get_queryset()</code> method. As a side effect, this changes the order of the HTTP method permissions and authentication checks, and 405 responses will only be returned when authenticated. If you want to replicate the old behavior, see the PR for details. <a href="https://github.com/encode/django-rest-framework/issues/5376">#5376</a></li>
<li>Deprecated <code>exclude_from_schema</code> on <code>APIView</code> and <code>api_view</code> decorator. Set <code>schema = None</code> or <code>@schema(None)</code> as appropriate. <a href="https://github.com/encode/django-rest-framework/issues/5422">#5422</a></li>
<li>
<p>Timezone-aware <code>DateTimeField</code>s now respect active or default <code>timezone</code> during serialization, instead of always using UTC. <a href="https://github.com/encode/django-rest-framework/issues/5435">#5435</a></p>
<p>Resolves inconsistency whereby instances were serialised with supplied datetime for <code>create</code> but UTC for <code>retrieve</code>. <a href="https://github.com/encode/django-rest-framework/issues/3732">#3732</a></p>
<p><strong>Possible backwards compatibility break</strong> if you were relying on datetime strings being UTC. Have client interpret datetimes or <a href="https://docs.djangoproject.com/en/1.11/topics/i18n/timezones/#default-time-zone-and-current-time-zone">set default or active timezone (docs)</a> to UTC if needed.</p>
</li>
<li>
<p>Removed DjangoFilterBackend inline with deprecation policy. Use <code>django_filters.rest_framework.FilterSet</code> and/or <code>django_filters.rest_framework.DjangoFilterBackend</code> instead. <a href="https://github.com/encode/django-rest-framework/issues/5273">#5273</a></p>
</li>
<li>Don't strip microseconds from <code>time</code> when encoding. Makes consistent with <code>datetime</code>.
<strong>BC Change</strong>: Previously only milliseconds were encoded. <a href="https://github.com/encode/django-rest-framework/issues/5440">#5440</a></li>
<li>Added <code>STRICT_JSON</code> setting (default <code>True</code>) to raise exception for the extended float values (<code>nan</code>, <code>inf</code>, <code>-inf</code>) accepted by Python's <code>json</code> module.
<strong>BC Change</strong>: Previously these values would converted to corresponding strings. Set <code>STRICT_JSON</code> to <code>False</code> to restore the previous behaviour. <a href="https://github.com/encode/django-rest-framework/issues/5265">#5265</a></li>
<li>Add support for <code>page_size</code> parameter in CursorPaginator class <a href="https://github.com/encode/django-rest-framework/issues/5250">#5250</a></li>
<li>Make <code>DEFAULT_PAGINATION_CLASS</code> <code>None</code> by default.
<strong>BC Change</strong>: If your were <strong>just</strong> setting <code>PAGE_SIZE</code> to enable pagination you will need to add <code>DEFAULT_PAGINATION_CLASS</code>.
The previous default was <code>rest_framework.pagination.PageNumberPagination</code>. There is a system check warning to catch this case. You may silence that if you are setting pagination class on a per-view basis. <a href="https://github.com/encode/django-rest-framework/issues/5170">#5170</a></li>
<li>Catch <code>APIException</code> from <code>get_serializer_fields</code> in schema generation. <a href="https://github.com/encode/django-rest-framework/issues/5443">#5443</a></li>
<li>Allow custom authentication and permission classes when using <code>include_docs_urls</code> <a href="https://github.com/encode/django-rest-framework/issues/5448">#5448</a></li>
<li>Defer translated string evaluation on validators. <a href="https://github.com/encode/django-rest-framework/issues/5452">#5452</a></li>
<li>Added default value for 'detail' param into 'ValidationError' exception <a href="https://github.com/encode/django-rest-framework/issues/5342">#5342</a></li>
<li>Adjust schema get_filter_fields rules to match framework <a href="https://github.com/encode/django-rest-framework/issues/5454">#5454</a></li>
<li>Updated test matrix to add Django 2.0 and drop Django 1.8 &amp; 1.9
<strong>BC Change</strong>: This removes Django 1.8 and Django 1.9 from Django REST Framework supported versions. <a href="https://github.com/encode/django-rest-framework/issues/5457">#5457</a></li>
<li>Fixed a deprecation warning in serializers.ModelField <a href="https://github.com/encode/django-rest-framework/issues/5058">#5058</a></li>
<li>Added a more explicit error message when <code>get_queryset</code> returned <code>None</code> <a href="https://github.com/encode/django-rest-framework/issues/5348">#5348</a></li>
<li>Fix docs for Response <code>data</code> description <a href="https://github.com/encode/django-rest-framework/issues/5361">#5361</a></li>
<li>Fix <strong>pychache</strong>/.pyc excludes when packaging <a href="https://github.com/encode/django-rest-framework/issues/5373">#5373</a></li>
<li>Fix default value handling for dotted sources <a href="https://github.com/encode/django-rest-framework/issues/5375">#5375</a></li>
<li>Ensure content_type is set when passing empty body to RequestFactory <a href="https://github.com/encode/django-rest-framework/issues/5351">#5351</a></li>
<li>Fix ErrorDetail Documentation <a href="https://github.com/encode/django-rest-framework/issues/5380">#5380</a></li>
<li>Allow optional content in the generic content form <a href="https://github.com/encode/django-rest-framework/issues/5372">#5372</a></li>
<li>Updated supported values for the NullBooleanField <a href="https://github.com/encode/django-rest-framework/issues/5387">#5387</a></li>
<li>Fix ModelSerializer custom named fields with source on model <a href="https://github.com/encode/django-rest-framework/issues/5388">#5388</a></li>
<li>Fixed the MultipleFieldLookupMixin documentation example to properly check for object level permission <a href="https://github.com/encode/django-rest-framework/issues/5398">#5398</a></li>
<li>Update get_object() example in permissions.md <a href="https://github.com/encode/django-rest-framework/issues/5401">#5401</a></li>
<li>Fix authtoken managment command <a href="https://github.com/encode/django-rest-framework/issues/5415">#5415</a></li>
<li>Fix schema generation markdown <a href="https://github.com/encode/django-rest-framework/issues/5421">#5421</a></li>
<li>Allow <code>ChoiceField.choices</code> to be set dynamically <a href="https://github.com/encode/django-rest-framework/issues/5426">#5426</a></li>
<li>Add the project layout to the quickstart <a href="https://github.com/encode/django-rest-framework/issues/5434">#5434</a></li>
<li>Reuse 'apply_markdown' function in 'render_markdown' templatetag <a href="https://github.com/encode/django-rest-framework/issues/5469">#5469</a></li>
<li>Added links to <code>drf-openapi</code> package in docs <a href="https://github.com/encode/django-rest-framework/issues/5470">#5470</a></li>
<li>Added docstrings code highlighting with pygments <a href="https://github.com/encode/django-rest-framework/issues/5462">#5462</a></li>
<li>Fixed documentation rendering for views named <code>data</code> <a href="https://github.com/encode/django-rest-framework/issues/5472">#5472</a></li>
<li>Docs: Clarified 'to_internal_value()' validation behavior <a href="https://github.com/encode/django-rest-framework/issues/5466">#5466</a></li>
<li>Fix missing six.text_type() call on APIException.<strong>str</strong> <a href="https://github.com/encode/django-rest-framework/issues/5476">#5476</a></li>
<li>Document documentation.py <a href="https://github.com/encode/django-rest-framework/issues/5478">#5478</a></li>
<li>Fix naming collisions in Schema Generation <a href="https://github.com/encode/django-rest-framework/issues/5464">#5464</a></li>
<li>Call Django's authenticate function with the request object <a href="https://github.com/encode/django-rest-framework/issues/5295">#5295</a></li>
<li>Update coreapi JS to 0.1.1 <a href="https://github.com/encode/django-rest-framework/issues/5479">#5479</a></li>
<li>Have <code>is_list_view</code> recognise RetrieveModel… views <a href="https://github.com/encode/django-rest-framework/issues/5480">#5480</a></li>
<li>Remove Django 1.8 &amp; 1.9 compatibility code <a href="https://github.com/encode/django-rest-framework/issues/5481">#5481</a></li>
<li>Remove deprecated schema code from DefaultRouter <a href="https://github.com/encode/django-rest-framework/issues/5482">#5482</a></li>
</ul>
<h2 id="36x-series"><a class="toclink" href="#36x-series">3.6.x series</a></h2>
<h3 id="364"><a class="toclink" href="#364">3.6.4</a></h3>
<p><strong>Date</strong>: <a href="https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.6.4+Release%22">21st August 2017</a></p>
@ -1125,6 +1192,8 @@
<!-- 3.6.3 -->
<!-- 3.6.4 -->
<!-- 3.7.0 -->
</div> <!--/span-->

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -464,7 +468,7 @@ from snippets.serializers import SnippetSerializer
@api_view(['GET', 'POST'])
def snippet_list(request):
"""
List all snippets, or create a new snippet.
List all code snippets, or create a new snippet.
"""
if request.method == 'GET':
snippets = Snippet.objects.all()
@ -483,7 +487,7 @@ def snippet_list(request):
<pre><code>@api_view(['GET', 'PUT', 'DELETE'])
def snippet_detail(request, pk):
"""
Retrieve, update or delete a snippet instance.
Retrieve, update or delete a code snippet.
"""
try:
snippet = Snippet.objects.get(pk=pk)

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -432,6 +436,7 @@ class UserViewSet(viewsets.ReadOnlyModelViewSet):
<p>Here we've used the <code>ReadOnlyModelViewSet</code> class to automatically provide the default 'read-only' operations. We're still setting the <code>queryset</code> and <code>serializer_class</code> attributes exactly as we did when we were using regular views, but we no longer need to provide the same information to two separate classes.</p>
<p>Next we're going to replace the <code>SnippetList</code>, <code>SnippetDetail</code> and <code>SnippetHighlight</code> view classes. We can remove the three views, and again replace them with a single class.</p>
<pre><code>from rest_framework.decorators import detail_route
from rest_framework.response import Response
class SnippetViewSet(viewsets.ModelViewSet):
"""

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>

View File

@ -318,6 +318,10 @@
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
@ -443,6 +447,28 @@ cd tutorial
django-admin.py startapp quickstart
cd ..
</code></pre>
<p>The project layout should look like:</p>
<pre><code>$ pwd
&lt;some path&gt;/tutorial
$ find .
.
./manage.py
./tutorial
./tutorial/__init__.py
./tutorial/quickstart
./tutorial/quickstart/__init__.py
./tutorial/quickstart/admin.py
./tutorial/quickstart/apps.py
./tutorial/quickstart/migrations
./tutorial/quickstart/migrations/__init__.py
./tutorial/quickstart/models.py
./tutorial/quickstart/tests.py
./tutorial/quickstart/views.py
./tutorial/settings.py
./tutorial/urls.py
./tutorial/wsgi.py
</code></pre>
<p>It may look unusual that the application has been created within the project directory. Using the project's namespace avoids name clashes with external module (topic goes outside the scope of the quickstart).</p>
<p>Now sync your database for the first time:</p>
<pre><code>python manage.py migrate
</code></pre>