Deployed de497a9b with MkDocs version: 1.0.4

This commit is contained in:
Tom Christie 2019-12-12 14:50:50 +00:00
parent 843deb7dea
commit 9d6bc0f1c3
85 changed files with 1026 additions and 177 deletions

View File

@ -297,6 +297,10 @@
<a href="/community/release-notes/">Release Notes</a>
</li>
<li >
<a href="/community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="/community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>
@ -438,11 +442,16 @@ provided in Django.</p>
decorators with class based views. This can be used with
other cache decorators such as <a href="https://docs.djangoproject.com/en/dev/topics/cache/#the-per-view-cache"><code>cache_page</code></a> and
<a href="https://docs.djangoproject.com/en/dev/topics/http/decorators/#django.views.decorators.vary.vary_on_cookie"><code>vary_on_cookie</code></a>.</p>
<pre><code class="python">from rest_framework.response import Response
<pre><code class="python">from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from django.views.decorators.vary import vary_on_cookie
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import viewsets
class UserViewSet(viewsets.Viewset):
class UserViewSet(viewsets.ViewSet):
# Cache requested url for each user for 2 hours
@method_decorator(cache_page(60*60*2))
@ -453,6 +462,7 @@ class UserViewSet(viewsets.Viewset):
}
return Response(content)
class PostView(APIView):
# Cache page for the requested url

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>
@ -660,8 +664,19 @@ Set to false if this field is not required to be present during deserialization.
<h3 id="default"><a class="toclink" href="#default"><code>default</code></a></h3>
<p>If set, this gives the default value that will be used for the field if no input value is supplied. If not set the default behaviour is to not populate the attribute at all.</p>
<p>The <code>default</code> is not applied during partial update operations. In the partial update case only fields that are provided in the incoming data will have a validated value returned.</p>
<p>May be set to a function or other callable, in which case the value will be evaluated each time it is used. When called, it will receive no arguments. If the callable has a <code>set_context</code> method, that will be called each time before getting the value with the field instance as only argument. This works the same way as for <a href="../validators/#using-set_context">validators</a>.</p>
<p>When serializing the instance, default will be used if the the object attribute or dictionary key is not present in the instance.</p>
<p>May be set to a function or other callable, in which case the value will be evaluated each time it is used. When called, it will receive no arguments. If the callable has a <code>requires_context = True</code> attribute, then the serializer field will be passed as an argument.</p>
<p>For example:</p>
<pre><code>class CurrentUserDefault:
"""
May be applied as a `default=...` value on a serializer field.
Returns the current user.
"""
requires_context = True
def __call__(self, serializer_field):
return serializer_field.context['request'].user
</code></pre>
<p>When serializing the instance, default will be used if the object attribute or dictionary key is not present in the instance.</p>
<p>Note that setting a <code>default</code> value implies that the field is not required. Including both the <code>default</code> and <code>required</code> keyword arguments is invalid and will raise an error.</p>
<h3 id="allow_null"><a class="toclink" href="#allow_null"><code>allow_null</code></a></h3>
<p>Normally an error will be raised if <code>None</code> is passed to a serializer field. Set this keyword argument to <code>True</code> if <code>None</code> should be considered a valid value.</p>
@ -1141,7 +1156,7 @@ class DataPointSerializer(serializers.ModelSerializer):
fields = ['label', 'coordinates']
</code></pre>
<p>Note that this example doesn't handle validation. Partly for that reason, in a
real project, the coordinate nesting might be better handled with a nested serialiser
real project, the coordinate nesting might be better handled with a nested serializer
using <code>source='*'</code>, with two <code>IntegerField</code> instances, each with their own <code>source</code>
pointing to the relevant field.</p>
<p>The key points from the example, though, are:</p>
@ -1176,7 +1191,7 @@ OrderedDict([('label', 'Second Example'),
</code></pre>
</li>
</ul>
<p>For completeness lets do the same thing again but with the nested serialiser
<p>For completeness lets do the same thing again but with the nested serializer
approach suggested above:</p>
<pre><code>class NestedCoordinateSerializer(serializers.Serializer):
x = serializers.IntegerField(source='x_coordinate')
@ -1195,13 +1210,13 @@ class DataPointSerializer(serializers.ModelSerializer):
declarations. It's our <code>NestedCoordinateSerializer</code> that takes <code>source='*'</code>.</p>
<p>Our new <code>DataPointSerializer</code> exhibits the same behaviour as the custom field
approach.</p>
<p>Serialising:</p>
<p>Serializing:</p>
<pre><code>&gt;&gt;&gt; out_serializer = DataPointSerializer(instance)
&gt;&gt;&gt; out_serializer.data
ReturnDict([('label', 'testing'),
('coordinates', OrderedDict([('x', 1), ('y', 2)]))])
</code></pre>
<p>Deserialising:</p>
<p>Deserializing:</p>
<pre><code>&gt;&gt;&gt; in_serializer = DataPointSerializer(data=data)
&gt;&gt;&gt; in_serializer.is_valid()
True
@ -1226,8 +1241,8 @@ ReturnDict([('coordinates',
{'x': ['A valid integer is required.'],
'y': ['A valid integer is required.']})])
</code></pre>
<p>For this reason, the nested serialiser approach would be the first to try. You
would use the custom field approach when the nested serialiser becomes infeasible
<p>For this reason, the nested serializer approach would be the first to try. You
would use the custom field approach when the nested serializer becomes infeasible
or overly complex.</p>
<h1 id="third-party-packages"><a class="toclink" href="#third-party-packages">Third party packages</a></h1>
<p>The following third party packages are also available.</p>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>
@ -513,10 +517,6 @@
</li>
<li>
<a href="#django-rest-framework-bulk">Django REST Framework bulk</a>
</li>
<li>
<a href="#django-rest-multiple-models">Django Rest Multiple Models</a>
</li>
@ -798,8 +798,6 @@ class BaseRetrieveUpdateDestroyView(MultipleFieldLookupMixin,
<hr />
<h1 id="third-party-packages"><a class="toclink" href="#third-party-packages">Third party packages</a></h1>
<p>The following third party packages provide additional generic view implementations.</p>
<h2 id="django-rest-framework-bulk"><a class="toclink" href="#django-rest-framework-bulk">Django REST Framework bulk</a></h2>
<p>The <a href="https://github.com/miki725/django-rest-framework-bulk">django-rest-framework-bulk package</a> implements generic view mixins as well as some common concrete generic views to allow to apply bulk operations via API requests.</p>
<h2 id="django-rest-multiple-models"><a class="toclink" href="#django-rest-multiple-models">Django Rest Multiple Models</a></h2>
<p><a href="https://github.com/MattBroach/DjangoRestMultipleModels">Django Rest Multiple Models</a> provides a generic view (and mixin) for sending multiple serialized models and/or querysets via a single API request.</p>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>
@ -733,7 +737,9 @@ class Track(models.Model):
</ul>
<hr />
<h1 id="nested-relationships"><a class="toclink" href="#nested-relationships">Nested relationships</a></h1>
<p>Nested relationships can be expressed by using serializers as fields.</p>
<p>As opposed to previously discussed <em>references</em> to another entity, the referred entity can instead also be embedded or <em>nested</em>
in the representation of the object that refers to it.
Such nested relationships can be expressed by using serializers as fields. </p>
<p>If the field is used to represent a to-many relationship, you should add the <code>many=True</code> flag to the serializer field.</p>
<h2 id="example"><a class="toclink" href="#example">Example</a></h2>
<p>For example, the following serializer:</p>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>
@ -528,7 +532,7 @@
<p>If a client sends a request with a content-type that cannot be parsed then a <code>UnsupportedMediaType</code> exception will be raised, which by default will be caught and return a <code>415 Unsupported Media Type</code> response.</p>
<hr />
<h1 id="content-negotiation"><a class="toclink" href="#content-negotiation">Content negotiation</a></h1>
<p>The request exposes some properties that allow you to determine the result of the content negotiation stage. This allows you to implement behaviour such as selecting a different serialisation schemes for different media types.</p>
<p>The request exposes some properties that allow you to determine the result of the content negotiation stage. This allows you to implement behaviour such as selecting a different serialization schemes for different media types.</p>
<h2 id="accepted_renderer"><a class="toclink" href="#accepted_renderer">.accepted_renderer</a></h2>
<p>The renderer instance that was selected by the content negotiation stage.</p>
<h2 id="accepted_media_type"><a class="toclink" href="#accepted_media_type">.accepted_media_type</a></h2>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>
@ -483,7 +487,7 @@
<h1 id="responses"><a class="toclink" href="#responses">Responses</a></h1>
<blockquote>
<p>Unlike basic HttpResponse objects, TemplateResponse objects retain the details of the context that was provided by the view to compute the response. The final output of the response is not computed until it is needed, later in the response process.</p>
<p>&mdash; <a href="https://docs.djangoproject.com/en/stable/stable/template-response/">Django documentation</a></p>
<p>&mdash; <a href="https://docs.djangoproject.com/en/stable/ref/template-response/">Django documentation</a></p>
</blockquote>
<p>REST framework supports HTTP content negotiation by providing a <code>Response</code> class which allows you to return content that can be rendered into multiple content types, depending on the client request.</p>
<p>The <code>Response</code> class subclasses Django's <code>SimpleTemplateResponse</code>. <code>Response</code> objects are initialised with data, which should consist of native Python primitives. REST framework then uses standard HTTP content negotiation to determine how it should render the final response content.</p>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>
@ -487,7 +491,7 @@ urlpatterns = [
<ul>
<li><code>title</code>: May be used to provide a descriptive title for the schema definition.</li>
<li><code>description</code>: Longer descriptive text.</li>
<li><code>version</code>: The version of the API. Defaults to <code>0.1.0</code>.</li>
<li><code>version</code>: The version of the API.</li>
<li>
<p><code>url</code>: May be used to pass a canonical base URL for the schema.</p>
<pre><code>schema_view = get_schema_view(
@ -506,20 +510,20 @@ urlpatterns = [
urlconf='myproject.urls'
)
</code></pre>
<ul>
</li>
<li>
<p><code>patterns</code>: List of url patterns to limit the schema introspection to. If you
only want the <code>myproject.api</code> urls to be exposed in the schema:</p>
<p>schema_url_patterns = [
<pre><code>schema_url_patterns = [
url(r'^api/', include('myproject.api.urls')),
]</p>
<p>schema_view = get_schema_view(
]
schema_view = get_schema_view(
title='Server Monitoring API',
url='https://www.example.org/api/',
patterns=schema_url_patterns,
)</p>
</li>
</ul>
)
</code></pre>
</li>
<li>
<p><code>generator_class</code>: May be used to specify a <code>SchemaGenerator</code> subclass to be
@ -563,7 +567,7 @@ schema = generator.get_schema()
</code></pre>
<p>The <code>request</code> argument is optional, and may be used if you want to apply
per-user permissions to the resulting schema generation.</p>
<p>This is a good point to override if you want to customise the generated
<p>This is a good point to override if you want to customize the generated
dictionary, for example to add custom
<a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#specification-extensions">specification extensions</a>.</p>
<h3 id="per-view-customization"><a class="toclink" href="#per-view-customization">Per-View Customization</a></h3>
@ -580,17 +584,17 @@ for each view, allowed method, and path.</p>
<p><strong>Note</strong>: For basic <code>APIView</code> subclasses, default introspection is essentially
limited to the URL kwarg path parameters. For <code>GenericAPIView</code>
subclasses, which includes all the provided class based views, <code>AutoSchema</code> will
attempt to introspect serialiser, pagination and filter fields, as well as
attempt to introspect serializer, pagination and filter fields, as well as
provide richer path field descriptions. (The key hooks here are the relevant
<code>GenericAPIView</code> attributes and methods: <code>get_serializer</code>, <code>pagination_class</code>,
<code>filter_backends</code> and so on.)</p>
<hr />
<p>In order to customise the operation generation, you should provide an <code>AutoSchema</code> subclass, overriding <code>get_operation()</code> as you need:</p>
<p>In order to customize the operation generation, you should provide an <code>AutoSchema</code> subclass, overriding <code>get_operation()</code> as you need:</p>
<pre><code> from rest_framework.views import APIView
from rest_framework.schemas.openapi import AutoSchema
class CustomSchema(AutoSchema):
def get_link(...):
def get_operation(...):
# Implement custom introspection here (or in other sub-methods)
class CustomView(APIView):

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>
@ -1305,10 +1309,10 @@ class BookSerializer(serializers.Serializer):
</code></pre>
<p>It's simple to create a read-only serializer for converting <code>HighScore</code> instances into primitive data types.</p>
<pre><code>class HighScoreSerializer(serializers.BaseSerializer):
def to_representation(self, obj):
def to_representation(self, instance):
return {
'score': obj.score,
'player_name': obj.player_name
'score': instance.score,
'player_name': instance.player_name
}
</code></pre>
<p>We can now use this class to serialize single <code>HighScore</code> instances:</p>
@ -1356,10 +1360,10 @@ def all_high_scores(request):
'player_name': player_name
}
def to_representation(self, obj):
def to_representation(self, instance):
return {
'score': obj.score,
'player_name': obj.player_name
'score': instance.score,
'player_name': instance.player_name
}
def create(self, validated_data):
@ -1373,10 +1377,10 @@ def all_high_scores(request):
A read-only serializer that coerces arbitrary complex objects
into primitive representations.
"""
def to_representation(self, obj):
def to_representation(self, instance):
output = {}
for attribute_name in dir(obj):
attribute = getattr(obj, attribute_name)
for attribute_name in dir(instance):
attribute = getattr(instance, attribute_name)
if attribute_name.startswith('_'):
# Ignore private attributes.
pass
@ -1413,9 +1417,9 @@ def all_high_scores(request):
<li>Improving serialization performance for a frequently accessed API endpoint that returns lots of data.</li>
</ul>
<p>The signatures for these methods are as follows:</p>
<h4 id="to_representationself-obj"><a class="toclink" href="#to_representationself-obj"><code>.to_representation(self, obj)</code></a></h4>
<h4 id="to_representationself-instance"><a class="toclink" href="#to_representationself-instance"><code>.to_representation(self, instance)</code></a></h4>
<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>
<p>May be overridden in order modify the representation style. For example:</p>
<p>May be overridden in order to modify the representation style. For example:</p>
<pre><code>def to_representation(self, instance):
"""Convert `username` to lowercase."""
ret = super().to_representation(instance)

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>
@ -552,7 +556,7 @@ print(api_settings.DEFAULT_AUTHENTICATION_CLASSES)
<p>Default: <code>'rest_framework.negotiation.DefaultContentNegotiation'</code></p>
<h4 id="default_schema_class"><a class="toclink" href="#default_schema_class">DEFAULT_SCHEMA_CLASS</a></h4>
<p>A view inspector class that will be used for schema generation.</p>
<p>Default: <code>'rest_framework.schemas.AutoSchema'</code></p>
<p>Default: <code>'rest_framework.schemas.openapi.AutoSchema'</code></p>
<hr />
<h2 id="generic-view-settings"><a class="toclink" href="#generic-view-settings">Generic view settings</a></h2>
<p><em>The following settings control the behavior of the generic class-based views.</em></p>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>
@ -717,12 +721,16 @@ to your <code>Serializer</code> subclass. This is documented in the
message = 'This field must be a multiple of %d.' % self.base
raise serializers.ValidationError(message)
</code></pre>
<h4 id="using-set_context"><a class="toclink" href="#using-set_context">Using <code>set_context()</code></a></h4>
<p>In some advanced cases you might want a validator to be passed the serializer field it is being used with as additional context. You can do so by declaring a <code>set_context</code> method on a class-based validator.</p>
<pre><code>def set_context(self, serializer_field):
# Determine if this is an update or a create operation.
# In `__call__` we can then use that information to modify the validation behavior.
self.is_update = serializer_field.parent.instance is not None
<h4 id="accessing-the-context"><a class="toclink" href="#accessing-the-context">Accessing the context</a></h4>
<p>In some advanced cases you might want a validator to be passed the serializer
field it is being used with as additional context. You can do so by setting
a <code>requires_context = True</code> attribute on the validator. The <code>__call__</code> method
will then be called with the <code>serializer_field</code>
or <code>serializer</code> as an additional argument.</p>
<pre><code>requires_context = True
def __call__(self, value, serializer_field):
...
</code></pre>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>
@ -566,12 +570,12 @@ Accept: application/json
</code></pre>
<p>Your URL conf must include a pattern that matches the version with a <code>'version'</code> keyword argument, so that this information is available to the versioning scheme.</p>
<pre><code>urlpatterns = [
url(
re_path(
r'^(?P&lt;version&gt;(v1|v2))/bookings/$',
bookings_list,
name='bookings-list'
),
url(
re_path(
r'^(?P&lt;version&gt;(v1|v2))/bookings/(?P&lt;pk&gt;[0-9]+)/$',
bookings_detail,
name='bookings-detail'
@ -588,14 +592,14 @@ Accept: application/json
<p>In the following example we're giving a set of views two different possible URL prefixes, each under a different namespace:</p>
<pre><code># bookings/urls.py
urlpatterns = [
url(r'^$', bookings_list, name='bookings-list'),
url(r'^(?P&lt;pk&gt;[0-9]+)/$', bookings_detail, name='bookings-detail')
re_path(r'^$', bookings_list, name='bookings-list'),
re_path(r'^(?P&lt;pk&gt;[0-9]+)/$', bookings_detail, name='bookings-detail')
]
# urls.py
urlpatterns = [
url(r'^v1/bookings/', include('bookings.urls', namespace='v1')),
url(r'^v2/bookings/', include('bookings.urls', namespace='v2'))
re_path(r'^v1/bookings/', include('bookings.urls', namespace='v1')),
re_path(r'^v2/bookings/', include('bookings.urls', namespace='v2'))
]
</code></pre>
<p>Both <code>URLPathVersioning</code> and <code>NamespaceVersioning</code> are reasonable if you just need a simple versioning scheme. The <code>URLPathVersioning</code> approach might be better suitable for small ad-hoc projects, and the <code>NamespaceVersioning</code> is probably easier to manage for larger projects.</p>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -61,7 +61,7 @@
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.9-announcement/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../release-notes/">
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.11-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>
@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li class="active" >
<a href="./">3.10 Announcement</a>
</li>
@ -508,7 +512,7 @@ urlpatterns = [
</code></pre>
<h3 id="customization"><a class="toclink" href="#customization">Customization</a></h3>
<p>For customizations that you want to apply across the the entire API, you can subclass <code>rest_framework.schemas.openapi.SchemaGenerator</code> and provide it as an argument
<p>For customizations that you want to apply across the entire API, you can subclass <code>rest_framework.schemas.openapi.SchemaGenerator</code> and provide it as an argument
to the <code>generateschema</code> command or <code>get_schema_view()</code> helper function.</p>
<p>For specific per-view customizations, you can subclass <code>AutoSchema</code>,
making sure to set <code>schema = &lt;YourCustomClass&gt;</code> on the view.</p>
@ -537,7 +541,7 @@ on keeping any tooling outside of the core framework.</p>
<h2 id="funding"><a class="toclink" href="#funding">Funding</a></h2>
<p>REST framework is a <em>collaboratively funded project</em>. If you use
REST framework commercially we strongly encourage you to invest in its
continued development by <strong><a href="community/funding.md">signing up for a paid plan</a></strong>.</p>
continued development by <strong><a href="../funding/">signing up for a paid plan</a></strong>.</p>
<p><em>Every single sign-up helps us make REST framework long-term financially sustainable.</em></p>
<ul class="premium-promo promo">
<li><a href="https://getsentry.com/welcome/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)">Sentry</a></li>

View File

@ -0,0 +1,588 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>3.11 Announcement - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="https://www.django-rest-framework.org/community/3.11-announcement/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 3.11 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="next" href="../3.10-announcement/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../release-notes/">
<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="https://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>
</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/caching/">Caching</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">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../project-management/">Project management</a>
</li>
<li >
<a href="../release-notes/">Release Notes</a>
</li>
<li class="active" >
<a href="./">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>
<li >
<a href="../3.9-announcement/">3.9 Announcement</a>
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 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="../jobs/">Jobs</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-311">Django REST framework 3.11</a>
</li>
<li>
<a href="#openapi-schema-generation-improvements">OpenAPI Schema Generation Improvements</a>
</li>
<li>
<a href="#validator-default-context">Validator / Default Context</a>
</li>
<li>
<a href="#funding">Funding</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-311"><a class="toclink" href="#django-rest-framework-311">Django REST framework 3.11</a></h1>
<p>The 3.11 release adds support for Django 3.0.</p>
<ul>
<li>Our supported Python versions are now: 3.5, 3.6, 3.7, and 3.8.</li>
<li>Our supported Django versions are now: 1.11, 2.0, 2.1, 2.2, and 3.0.</li>
</ul>
<p>This release will be the last to support Python 3.5 or Django 1.11.</p>
<h2 id="openapi-schema-generation-improvements"><a class="toclink" href="#openapi-schema-generation-improvements">OpenAPI Schema Generation Improvements</a></h2>
<p>The OpenAPI schema generation continues to mature. Some highlights in 3.11
include:</p>
<ul>
<li>Automatic mapping of Django REST Framework renderers and parsers into OpenAPI
request and response media-types.</li>
<li>Improved mapping JSON schema mapping types, for example in HStoreFields, and
with large integer values.</li>
<li>Porting of the old CoreAPI parsing of docstrings to form OpenAPI operation
descriptions.</li>
</ul>
<p>In this example view operation descriptions for the <code>get</code> and <code>post</code> methods will
be extracted from the class docstring:</p>
<pre><code class="python">class DocStringExampleListView(APIView):
&quot;&quot;&quot;
get: A description of my GET operation.
post: A description of my POST operation.
&quot;&quot;&quot;
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
def get(self, request, *args, **kwargs):
...
def post(self, request, *args, **kwargs):
...
</code></pre>
<h2 id="validator-default-context"><a class="toclink" href="#validator-default-context">Validator / Default Context</a></h2>
<p>In some circumstances a Validator class or a Default class may need to access the serializer field with which it is called, or the <code>.context</code> with which the serializer was instantiated. In particular:</p>
<ul>
<li>Uniqueness validators need to be able to determine the name of the field to which they are applied, in order to run an appropriate database query.</li>
<li>The <code>CurrentUserDefault</code> needs to be able to determine the context with which the serializer was instantiated, in order to return the current user instance.</li>
</ul>
<p>Previous our approach to this was that implementations could include a <code>set_context</code> method, which would be called prior to validation. However this approach had issues with potential race conditions. We have now move this approach into a pending deprecation state. It will continue to function, but will be escalated to a deprecated state in 3.12, and removed entirely in 3.13.</p>
<p>Instead, validators or defaults which require the serializer context, should include a <code>requires_context = True</code> attribute on the class.</p>
<p>The <code>__call__</code> method should then include an additional <code>serializer_field</code> argument.</p>
<p>Validator implementations will look like this:</p>
<pre><code class="python">class CustomValidator:
requires_context = True
def __call__(self, value, serializer_field):
...
</code></pre>
<p>Default implementations will look like this:</p>
<pre><code class="python">class CustomDefault:
requires_context = True
def __call__(self, serializer_field):
...
</code></pre>
<hr />
<h2 id="funding"><a class="toclink" href="#funding">Funding</a></h2>
<p>REST framework is a <em>collaboratively funded project</em>. If you use
REST framework commercially we strongly encourage you to invest in its
continued development by <strong><a href="../funding/">signing up for a paid plan</a></strong>.</p>
<p><em>Every single sign-up helps us make REST framework long-term financially sustainable.</em></p>
<ul class="premium-promo promo">
<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://software.esg-usa.com" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/esg-new-logo.png)">ESG</a></li>
<li><a href="https://rollbar.com" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rollbar2.png)">Rollbar</a></li>
<li><a href="https://cadre.com" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/cadre.png)">Cadre</a></li>
<li><a href="https://hubs.ly/H0f30Lf0" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/kloudless-plus-text.png)">Kloudless</a></li>
<li><a href="https://lightsonsoftware.com" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/lightson-dark.png)">Lights On Software</a></li>
<li><a href="https://retool.com/?utm_source=djangorest&utm_medium=sponsorship" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/retool-sidebar.png)">Retool</a></li>
</ul>
<div style="clear: both; padding-bottom: 20px;"></div>
<p><em>Many thanks to all our <a href="https://fund.django-rest-framework.org/topics/funding/#our-sponsors">wonderful sponsors</a>, and in particular to our premium backers, <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://software.esg-usa.com/">ESG</a>, <a href="https://rollbar.com/?utm_source=django&amp;utm_medium=sponsorship&amp;utm_campaign=freetrial">Rollbar</a>, <a href="https://cadre.com">Cadre</a>, <a href="https://hubs.ly/H0f30Lf0">Kloudless</a>, <a href="https://lightsonsoftware.com">Lights On Software</a>, and <a href="https://retool.com/?utm_source=djangorest&amp;utm_medium=sponsorship">Retool</a>.</em></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 async src="https://fund.django-rest-framework.org/sidebar_include.js"></script>
<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="../../js/theme.js"></script>
<script>var base_url = '../..';</script>
<script src="../../search/main.js" defer></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

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>
@ -600,7 +604,6 @@ django-admin compilemessages
<h4 id="outstanding-management-ownership-issues"><a class="toclink" href="#outstanding-management-ownership-issues">Outstanding management &amp; ownership issues</a></h4>
<p>The following issues still need to be addressed:</p>
<ul>
<li><a href="https://github.com/encode/django-rest-framework/issues/2162">Consider moving the repo into a proper GitHub organization</a>.</li>
<li>Ensure <code>@jamie</code> has back-up access to the <code>django-rest-framework.org</code> domain setup and admin.</li>
<li>Document ownership of the <a href="https://restframework.herokuapp.com/">live example</a> API.</li>
<li>Document ownership of the <a href="https://groups.google.com/forum/#!forum/django-rest-framework">mailing list</a> and IRC channel.</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="next" href="../3.10-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.11-announcement/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../project-management/">
@ -297,6 +297,10 @@
<a href="./">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>
@ -477,10 +481,6 @@
<h1 id="release-notes"><a class="toclink" href="#release-notes">Release Notes</a></h1>
<blockquote>
<p>Release Early, Release Often</p>
<p>&mdash; Eric S. Raymond, <a href="http://www.catb.org/~esr/writings/cathedral-bazaar/cathedral-bazaar/ar01s04.html">The Cathedral and the Bazaar</a>.</p>
</blockquote>
<h2 id="versioning"><a class="toclink" href="#versioning">Versioning</a></h2>
<p>Minor version numbers (0.0.x) are used for changes that are API compatible. You should be able to upgrade between minor point releases without any other code changes.</p>
<p>Medium version numbers (0.x.0) may include API changes, in line with the <a href="#deprecation-policy">deprecation policy</a>. You should read the release notes carefully before upgrading between medium point releases.</p>
@ -671,11 +671,11 @@ the view:</p>
<pre><code>def perform_create(self, serializer):
serializer.save(owner=self.request.user)
</code></pre>
<p>Alternatively you may override <code>save()</code> or <code>create()</code> or <code>update()</code> on the serialiser as appropriate.</p>
<p>Alternatively you may override <code>save()</code> or <code>create()</code> or <code>update()</code> on the serializer as appropriate.</p>
</li>
<li>
<p>Correct allow_null behaviour when required=False <a href="https://github.com/encode/django-rest-framework/issues/5888">#5888</a></p>
<p>Without an explicit <code>default</code>, <code>allow_null</code> implies a default of <code>null</code> for outgoing serialisation. Previously such
<p>Without an explicit <code>default</code>, <code>allow_null</code> implies a default of <code>null</code> for outgoing serialization. Previously such
fields were being skipped when read-only or otherwise not required.</p>
<p><strong>Possible backwards compatibility break</strong> if you were relying on such fields being excluded from the outgoing
representation. In order to restore the old behaviour you can override <code>data</code> to exclude the field when <code>None</code>.</p>
@ -901,7 +901,7 @@ Previously may have been stored internally as <code>None</code>.</p>
<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>Resolves inconsistency whereby instances were serialized 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>

View File

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>
@ -592,7 +596,6 @@ You probably want to also tag the version now:
</ul>
<h3 id="views"><a class="toclink" href="#views">Views</a></h3>
<ul>
<li><a href="https://github.com/miki725/django-rest-framework-bulk">djangorestframework-bulk</a> - Implements generic view mixins as well as some common concrete generic views to allow to apply bulk operations via API requests.</li>
<li><a href="https://github.com/MattBroach/DjangoRestMultipleModels">django-rest-multiple-models</a> - Provides a generic view (and mixin) for sending multiple serialized models and/or querysets via a single API request.</li>
</ul>
<h3 id="routers"><a class="toclink" href="#routers">Routers</a></h3>
@ -624,8 +627,7 @@ You probably want to also tag the version now:
<h3 id="misc"><a class="toclink" href="#misc">Misc</a></h3>
<ul>
<li><a href="https://github.com/agconti/cookiecutter-django-rest">cookiecutter-django-rest</a> - A cookiecutter template that takes care of the setup and configuration so you can focus on making your REST apis awesome.</li>
<li><a href="https://github.com/fredkingham/django_rest_model_hyperlink_serializers_project">djangorestrelationalhyperlink</a> - A hyperlinked serialiser that can can be used to alter relationships via hyperlinks, but otherwise like a hyperlink model serializer.</li>
<li><a href="https://github.com/marcgibbons/django-rest-swagger">django-rest-swagger</a> - An API documentation generator for Swagger UI.</li>
<li><a href="https://github.com/fredkingham/django_rest_model_hyperlink_serializers_project">djangorestrelationalhyperlink</a> - A hyperlinked serializer that can can be used to alter relationships via hyperlinks, but otherwise like a hyperlink model serializer.</li>
<li><a href="https://github.com/eofs/django-rest-framework-proxy">django-rest-framework-proxy</a> - Proxy to redirect incoming request to another API server.</li>
<li><a href="https://github.com/AppsFuel/gaiarestframework">gaiarestframework</a> - Utils for django-rest-framework</li>
<li><a href="https://github.com/chibisov/drf-extensions">drf-extensions</a> - A collection of custom extensions</li>
@ -642,6 +644,7 @@ You probably want to also tag the version now:
<li><a href="https://github.com/jozo/django-rest-framework-condition">django-rest-framework-condition</a> - Decorators for managing HTTP cache headers for Django REST framework (ETag and Last-modified).</li>
<li><a href="https://github.com/shosca/django-rest-witchcraft">django-rest-witchcraft</a> - Provides DRF integration with SQLAlchemy with SQLAlchemy model serializers/viewsets and a bunch of other goodies</li>
<li><a href="https://github.com/corteva/djangorestframework-mvt">djangorestframework-mvt</a> - An extension for creating views that serve Postgres data as Map Box Vector Tiles.</li>
<li><a href="https://github.com/cloudcode-hungary/django-rest-framework-features/">djangorestframework-features</a> - Advanced schema generation and more based on named features.</li>
</ul>

View File

@ -297,6 +297,10 @@
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>
@ -707,7 +711,7 @@ each view, allowed method and path.)</p>
<p><strong>Note</strong>: For basic <code>APIView</code> subclasses, default introspection is essentially
limited to the URL kwarg path parameters. For <code>GenericAPIView</code>
subclasses, which includes all the provided class based views, <code>AutoSchema</code> will
attempt to introspect serialiser, pagination and filter fields, as well as
attempt to introspect serializer, pagination and filter fields, as well as
provide richer path field descriptions. (The key hooks here are the relevant
<code>GenericAPIView</code> attributes and methods: <code>get_serializer</code>, <code>pagination_class</code>,
<code>filter_backends</code> and so on.)</p>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -297,6 +297,10 @@
<a href="community/release-notes/">Release Notes</a>
</li>
<li >
<a href="community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="community/3.10-announcement/">3.10 Announcement</a>
</li>
@ -524,7 +528,7 @@
<li><a href="api-guide/authentication/">Authentication policies</a> including packages for <a href="api-guide/authentication/#django-rest-framework-oauth">OAuth1a</a> and <a href="api-guide/authentication/#django-oauth-toolkit">OAuth2</a>.</li>
<li><a href="api-guide/serializers/">Serialization</a> that supports both <a href="api-guide/serializers#modelserializer">ORM</a> and <a href="api-guide/serializers#serializers">non-ORM</a> data sources.</li>
<li>Customizable all the way down - just use <a href="api-guide/views#function-based-views">regular function-based views</a> if you don't need the <a href="api-guide/generic-views/">more</a> <a href="api-guide/viewsets/">powerful</a> <a href="api-guide/routers/">features</a>.</li>
<li><a href=".">Extensive documentation</a>, and <a href="https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework">great community support</a>.</li>
<li>Extensive documentation, and <a href="https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework">great community support</a>.</li>
<li>Used and trusted by internationally recognised companies including <a href="https://www.mozilla.org/en-US/about/">Mozilla</a>, <a href="https://www.redhat.com/">Red Hat</a>, <a href="https://www.heroku.com/">Heroku</a>, and <a href="https://www.eventbrite.co.uk/about/">Eventbrite</a>.</li>
</ul>
<hr />
@ -551,8 +555,8 @@ continued development by <strong><a href="community/funding/">signing up for a p
<h2 id="requirements"><a class="toclink" href="#requirements">Requirements</a></h2>
<p>REST framework requires the following:</p>
<ul>
<li>Python (3.5, 3.6, 3.7)</li>
<li>Django (1.11, 2.0, 2.1, 2.2)</li>
<li>Python (3.5, 3.6, 3.7, 3.8)</li>
<li>Django (1.11, 2.0, 2.1, 2.2, 3.0)</li>
</ul>
<p>We <strong>highly recommend</strong> and only officially support the latest patch release of
each Python and Django series.</p>

File diff suppressed because one or more lines are too long

View File

@ -2,322 +2,327 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.django-rest-framework.org/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/tutorial/quickstart/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/tutorial/1-serialization/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/tutorial/2-requests-and-responses/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/tutorial/3-class-based-views/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/tutorial/4-authentication-and-permissions/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/tutorial/5-relationships-and-hyperlinked-apis/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/requests/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/responses/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/views/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/generic-views/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/viewsets/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/routers/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/parsers/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/renderers/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/serializers/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/fields/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/relations/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/validators/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/authentication/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/permissions/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/caching/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/throttling/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/filtering/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/pagination/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/versioning/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/content-negotiation/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/metadata/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/schemas/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/format-suffixes/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/reverse/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/exceptions/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/status-codes/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/testing/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/settings/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/topics/documenting-your-api/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/topics/api-clients/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/topics/internationalization/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/topics/ajax-csrf-cors/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/topics/html-and-forms/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/topics/browser-enhancements/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/topics/browsable-api/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/topics/rest-hypermedia-hateoas/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/tutorials-and-resources/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/third-party-packages/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/contributing/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/project-management/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/release-notes/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.11-announcement/</loc>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.10-announcement/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.9-announcement/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.8-announcement/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.7-announcement/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.6-announcement/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.5-announcement/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.4-announcement/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.3-announcement/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.2-announcement/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.1-announcement/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.0-announcement/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/kickstarter-announcement/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/mozilla-grant/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/funding/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/jobs/</loc>
<lastmod>2019-10-07</lastmod>
<lastmod>2019-12-12</lastmod>
<changefreq>daily</changefreq>
</url>
</urlset>

Binary file not shown.

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>
@ -498,7 +502,7 @@ urlpatterns = [
<p>See the <a href="https://swagger.io/tools/swagger-ui/">Swagger UI documentation</a> for advanced usage.</p>
<h3 id="a-minimal-example-with-redoc"><a class="toclink" href="#a-minimal-example-with-redoc">A minimal example with ReDoc.</a></h3>
<p>Assuming you've followed the example from the schemas documentation for routing
a dynamic <code>SchemaView</code>, a minimal Django template for using Swagger UI might be
a dynamic <code>SchemaView</code>, a minimal Django template for using ReDoc might be
this:</p>
<pre><code class="html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
@ -550,40 +554,6 @@ generation tools like <code>swagger-codegen</code>.</p>
<p>This also translates into a very useful interactive documentation viewer in the form of <code>swagger-ui</code>:</p>
<p><img alt="Screenshot - drf-yasg" src="../../img/drf-yasg.png" /></p>
<hr />
<h4 id="django-rest-swagger"><a class="toclink" href="#django-rest-swagger">Django REST Swagger</a></h4>
<p>Marc Gibbons' <a href="https://github.com/marcgibbons/django-rest-swagger">Django REST Swagger</a> integrates REST framework with the <a href="https://swagger.io/">Swagger</a> API documentation tool. The package produces well presented API documentation, and includes interactive tools for testing API endpoints.</p>
<p>Django REST Swagger supports REST framework versions 2.3 and above.</p>
<p>Mark is also the author of the <a href="https://github.com/marcgibbons/django-rest-framework-docs">REST Framework Docs</a> package which offers clean, simple autogenerated documentation for your API but is deprecated and has moved to Django REST Swagger.</p>
<p>This package is fully documented, well supported, and comes highly recommended.</p>
<p><img alt="Screenshot - Django REST Swagger" src="../../img/django-rest-swagger.png" /></p>
<hr />
<h3 id="drf-autodocs"><a class="toclink" href="#drf-autodocs">DRF AutoDocs</a></h3>
<p>Oleksander Mashianovs' <a href="https://github.com/iMakedonsky/drf-autodocs">DRF Auto Docs</a> automated api renderer.</p>
<p>Collects almost all the code you written into documentation effortlessly.</p>
<p>Supports:</p>
<ul>
<li>functional view docs</li>
<li>tree-like structure</li>
<li>Docstrings:</li>
<li>markdown</li>
<li>preserve space &amp; newlines</li>
<li>formatting with nice syntax</li>
<li>Fields:</li>
<li>choices rendering</li>
<li>help_text (to specify SerializerMethodField output, etc)</li>
<li>smart read_only/required rendering</li>
<li>Endpoint properties:</li>
<li>filter_backends</li>
<li>authentication_classes</li>
<li>permission_classes</li>
<li>extra url params(GET params)</li>
</ul>
<p><img alt="whole structure" src="http://joxi.ru/52aBGNI4k3oyA0.jpg" /></p>
<hr />
<h4 id="apiary"><a class="toclink" href="#apiary">Apiary</a></h4>
<p>There are various other online tools and services for providing API documentation. One notable service is <a href="https://apiary.io/">Apiary</a>. With Apiary, you describe your API using a simple markdown-like syntax. The generated documentation includes API interaction, a mock server for testing &amp; prototyping, and various other tools.</p>
<p><img alt="Screenshot - Apiary" src="../../img/apiary.png" /></p>
<hr />
<h2 id="self-describing-apis"><a class="toclink" href="#self-describing-apis">Self describing APIs</a></h2>
<p>The browsable API that REST framework provides makes it possible for your API to be entirely self describing. The documentation for each API endpoint can be provided simply by visiting the URL in your browser.</p>
<p><img alt="Screenshot - Self describing API" src="../../img/self-describing.png" /></p>
@ -604,7 +574,7 @@ generation tools like <code>swagger-codegen</code>.</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 list and retrieve views, use docstring sections as described in <a href="../api-guide/schemas/#examples">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

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>
@ -475,8 +479,7 @@ request.data # Handles arbitrary data. Works for 'POST', 'PUT' and 'PATCH' met
<p>These wrappers provide a few bits of functionality such as making sure you receive <code>Request</code> instances in your view, and adding context to <code>Response</code> objects so that content negotiation can be performed.</p>
<p>The wrappers also provide behaviour such as returning <code>405 Method Not Allowed</code> responses when appropriate, and handling any <code>ParseError</code> exception that occurs when accessing <code>request.data</code> with malformed input.</p>
<h2 id="pulling-it-all-together"><a class="toclink" href="#pulling-it-all-together">Pulling it all together</a></h2>
<p>Okay, let's go ahead and start using these new components to write a few views.</p>
<p>We don't need our <code>JSONResponse</code> class in <code>views.py</code> any more, so go ahead and delete that. Once that's done we can start refactoring our views slightly.</p>
<p>Okay, let's go ahead and start using these new components to refactor our views slightly.</p>
<pre><code>from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>

View File

@ -297,6 +297,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
</li>
<li >
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
</li>