From 9d6bc0f1c3f44f5dca6118270ec06bbdeda902fb Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Thu, 12 Dec 2019 14:50:50 +0000
Subject: [PATCH] Deployed de497a9b with MkDocs version: 1.0.4
---
404.html | 4 +
api-guide/authentication/index.html | 4 +
api-guide/caching/index.html | 14 +-
api-guide/content-negotiation/index.html | 4 +
api-guide/exceptions/index.html | 4 +
api-guide/fields/index.html | 31 +-
api-guide/filtering/index.html | 4 +
api-guide/format-suffixes/index.html | 4 +
api-guide/generic-views/index.html | 10 +-
api-guide/metadata/index.html | 4 +
api-guide/pagination/index.html | 4 +
api-guide/parsers/index.html | 4 +
api-guide/permissions/index.html | 4 +
api-guide/relations/index.html | 8 +-
api-guide/renderers/index.html | 4 +
api-guide/requests/index.html | 6 +-
api-guide/responses/index.html | 6 +-
api-guide/reverse/index.html | 4 +
api-guide/routers/index.html | 4 +
api-guide/schemas/index.html | 28 +-
api-guide/serializers/index.html | 26 +-
api-guide/settings/index.html | 6 +-
api-guide/status-codes/index.html | 4 +
api-guide/testing/index.html | 4 +
api-guide/throttling/index.html | 4 +
api-guide/validators/index.html | 20 +-
api-guide/versioning/index.html | 16 +-
api-guide/views/index.html | 4 +
api-guide/viewsets/index.html | 4 +
community/3.0-announcement/index.html | 4 +
community/3.1-announcement/index.html | 4 +
community/3.10-announcement/index.html | 10 +-
community/3.11-announcement/index.html | 588 ++++++++++++++++++
community/3.2-announcement/index.html | 4 +
community/3.3-announcement/index.html | 4 +
community/3.4-announcement/index.html | 4 +
community/3.5-announcement/index.html | 4 +
community/3.6-announcement/index.html | 4 +
community/3.7-announcement/index.html | 4 +
community/3.8-announcement/index.html | 4 +
community/3.9-announcement/index.html | 4 +
community/contributing/index.html | 4 +
community/funding/index.html | 4 +
community/jobs/index.html | 4 +
community/kickstarter-announcement/index.html | 4 +
community/mozilla-grant/index.html | 4 +
community/project-management/index.html | 5 +-
community/release-notes/index.html | 16 +-
community/third-party-packages/index.html | 9 +-
community/tutorials-and-resources/index.html | 4 +
.../7-schemas-and-client-libraries/index.html | 4 +
coreapi/from-documenting-your-api/index.html | 4 +
coreapi/index.html | 4 +
coreapi/schemas/index.html | 6 +-
img/apiary.png | Bin 55554 -> 0 bytes
img/django-rest-swagger.png | Bin 76945 -> 0 bytes
img/premium/cadre-readme.png | Bin 7021 -> 6989 bytes
img/premium/esg-readme.png | Bin 13650 -> 13590 bytes
img/premium/kloudless-readme.png | Bin 14607 -> 14582 bytes
img/premium/lightson-readme.png | Bin 16507 -> 16420 bytes
img/premium/release-history.png | Bin 18009 -> 17960 bytes
img/premium/retool-readme.png | Bin 9086 -> 9053 bytes
img/premium/rollbar-readme.png | Bin 17370 -> 17335 bytes
img/premium/sentry-readme.png | Bin 24556 -> 24549 bytes
img/premium/stream-readme.png | Bin 19311 -> 19281 bytes
index.html | 10 +-
search/search_index.json | 2 +-
sitemap.xml | 133 ++--
sitemap.xml.gz | Bin 750 -> 755 bytes
topics/ajax-csrf-cors/index.html | 4 +
topics/api-clients/index.html | 4 +
topics/browsable-api/index.html | 4 +
topics/browser-enhancements/index.html | 4 +
topics/documenting-your-api/index.html | 42 +-
topics/html-and-forms/index.html | 4 +
topics/internationalization/index.html | 4 +
topics/rest-hypermedia-hateoas/index.html | 4 +
topics/writable-nested-serializers/index.html | 4 +
tutorial/1-serialization/index.html | 4 +
tutorial/2-requests-and-responses/index.html | 7 +-
tutorial/3-class-based-views/index.html | 4 +
.../index.html | 4 +
.../index.html | 4 +
tutorial/6-viewsets-and-routers/index.html | 4 +
tutorial/quickstart/index.html | 4 +
85 files changed, 1026 insertions(+), 177 deletions(-)
create mode 100644 community/3.11-announcement/index.html
delete mode 100644 img/apiary.png
delete mode 100644 img/django-rest-swagger.png
diff --git a/404.html b/404.html
index 002541630..1402fb9f4 100644
--- a/404.html
+++ b/404.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/api-guide/authentication/index.html b/api-guide/authentication/index.html
index b2059f32d..08450aee5 100644
--- a/api-guide/authentication/index.html
+++ b/api-guide/authentication/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/api-guide/caching/index.html b/api-guide/caching/index.html
index 529757906..107c6d099 100644
--- a/api-guide/caching/index.html
+++ b/api-guide/caching/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
@@ -438,11 +442,16 @@ provided in Django.
decorators with class based views. This can be used with
other cache decorators such as cache_page
and
vary_on_cookie
.
-from rest_framework.response import Response
+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
diff --git a/api-guide/content-negotiation/index.html b/api-guide/content-negotiation/index.html
index a6981c064..f4964e7d5 100644
--- a/api-guide/content-negotiation/index.html
+++ b/api-guide/content-negotiation/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/api-guide/exceptions/index.html b/api-guide/exceptions/index.html
index cb50a0245..fff502414 100644
--- a/api-guide/exceptions/index.html
+++ b/api-guide/exceptions/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/api-guide/fields/index.html b/api-guide/fields/index.html
index 664955b3e..f1902114f 100644
--- a/api-guide/fields/index.html
+++ b/api-guide/fields/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
@@ -660,8 +664,19 @@ Set to false if this field is not required to be present during deserialization.
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.
The default
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.
-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 set_context
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 validators.
-When serializing the instance, default will be used if the the object attribute or dictionary key is not present in the instance.
+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 requires_context = True
attribute, then the serializer field will be passed as an argument.
+For example:
+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
+
+When serializing the instance, default will be used if the object attribute or dictionary key is not present in the instance.
Note that setting a default
value implies that the field is not required. Including both the default
and required
keyword arguments is invalid and will raise an error.
Normally an error will be raised if None
is passed to a serializer field. Set this keyword argument to True
if None
should be considered a valid value.
@@ -1141,7 +1156,7 @@ class DataPointSerializer(serializers.ModelSerializer):
fields = ['label', 'coordinates']
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 source='*'
, with two IntegerField
instances, each with their own source
pointing to the relevant field.
The key points from the example, though, are:
@@ -1176,7 +1191,7 @@ OrderedDict([('label', 'Second Example'),
-For completeness lets do the same thing again but with the nested serialiser
+
For completeness lets do the same thing again but with the nested serializer
approach suggested above:
class NestedCoordinateSerializer(serializers.Serializer):
x = serializers.IntegerField(source='x_coordinate')
@@ -1195,13 +1210,13 @@ class DataPointSerializer(serializers.ModelSerializer):
declarations. It's our NestedCoordinateSerializer
that takes source='*'
.
Our new DataPointSerializer
exhibits the same behaviour as the custom field
approach.
-Serialising:
+Serializing:
>>> out_serializer = DataPointSerializer(instance)
>>> out_serializer.data
ReturnDict([('label', 'testing'),
('coordinates', OrderedDict([('x', 1), ('y', 2)]))])
-Deserialising:
+Deserializing:
>>> in_serializer = DataPointSerializer(data=data)
>>> in_serializer.is_valid()
True
@@ -1226,8 +1241,8 @@ ReturnDict([('coordinates',
{'x': ['A valid integer is required.'],
'y': ['A valid integer is required.']})])
-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
+
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.
The following third party packages are also available.
diff --git a/api-guide/filtering/index.html b/api-guide/filtering/index.html
index 1320ca723..7f6e4ad4c 100644
--- a/api-guide/filtering/index.html
+++ b/api-guide/filtering/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/api-guide/format-suffixes/index.html b/api-guide/format-suffixes/index.html
index b70338702..9fceab821 100644
--- a/api-guide/format-suffixes/index.html
+++ b/api-guide/format-suffixes/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/api-guide/generic-views/index.html b/api-guide/generic-views/index.html
index e56c7ca0d..8e553d9af 100644
--- a/api-guide/generic-views/index.html
+++ b/api-guide/generic-views/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
@@ -513,10 +517,6 @@
-
- Django REST Framework bulk
-
-
Django Rest Multiple Models
@@ -798,8 +798,6 @@ class BaseRetrieveUpdateDestroyView(MultipleFieldLookupMixin,
The following third party packages provide additional generic view implementations.
-
-The django-rest-framework-bulk package implements generic view mixins as well as some common concrete generic views to allow to apply bulk operations via API requests.
Django Rest Multiple Models provides a generic view (and mixin) for sending multiple serialized models and/or querysets via a single API request.
diff --git a/api-guide/metadata/index.html b/api-guide/metadata/index.html
index 0895a62bc..4b9165649 100644
--- a/api-guide/metadata/index.html
+++ b/api-guide/metadata/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/api-guide/pagination/index.html b/api-guide/pagination/index.html
index faf4b9565..ce26f10b1 100644
--- a/api-guide/pagination/index.html
+++ b/api-guide/pagination/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/api-guide/parsers/index.html b/api-guide/parsers/index.html
index 3ac2f48de..2c505f159 100644
--- a/api-guide/parsers/index.html
+++ b/api-guide/parsers/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/api-guide/permissions/index.html b/api-guide/permissions/index.html
index ad19b9aee..d3c881a74 100644
--- a/api-guide/permissions/index.html
+++ b/api-guide/permissions/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/api-guide/relations/index.html b/api-guide/relations/index.html
index 9451d4263..a5a193a1e 100644
--- a/api-guide/relations/index.html
+++ b/api-guide/relations/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
@@ -733,7 +737,9 @@ class Track(models.Model):
-Nested relationships can be expressed by using serializers as fields.
+As opposed to previously discussed references to another entity, the referred entity can instead also be embedded or nested
+in the representation of the object that refers to it.
+Such nested relationships can be expressed by using serializers as fields.
If the field is used to represent a to-many relationship, you should add the many=True
flag to the serializer field.
For example, the following serializer:
diff --git a/api-guide/renderers/index.html b/api-guide/renderers/index.html
index 4be4a1387..f9cc6281d 100644
--- a/api-guide/renderers/index.html
+++ b/api-guide/renderers/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/api-guide/requests/index.html b/api-guide/requests/index.html
index c8c814048..c6155630f 100644
--- a/api-guide/requests/index.html
+++ b/api-guide/requests/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
@@ -528,7 +532,7 @@
If a client sends a request with a content-type that cannot be parsed then a UnsupportedMediaType
exception will be raised, which by default will be caught and return a 415 Unsupported Media Type
response.
-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.
+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.
The renderer instance that was selected by the content negotiation stage.
diff --git a/api-guide/responses/index.html b/api-guide/responses/index.html
index 6a27ee272..33d760a48 100644
--- a/api-guide/responses/index.html
+++ b/api-guide/responses/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
@@ -483,7 +487,7 @@
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.
-— Django documentation
+— Django documentation
REST framework supports HTTP content negotiation by providing a Response
class which allows you to return content that can be rendered into multiple content types, depending on the client request.
The Response
class subclasses Django's SimpleTemplateResponse
. Response
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.
diff --git a/api-guide/reverse/index.html b/api-guide/reverse/index.html
index 3afa2b67f..0853a0f7c 100644
--- a/api-guide/reverse/index.html
+++ b/api-guide/reverse/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/api-guide/routers/index.html b/api-guide/routers/index.html
index 6c6e5b492..b45bcb3b5 100644
--- a/api-guide/routers/index.html
+++ b/api-guide/routers/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/api-guide/schemas/index.html b/api-guide/schemas/index.html
index 5ec13eb9e..767711b46 100644
--- a/api-guide/schemas/index.html
+++ b/api-guide/schemas/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
@@ -487,7 +491,7 @@ urlpatterns = [
title
: May be used to provide a descriptive title for the schema definition.
description
: Longer descriptive text.
-version
: The version of the API. Defaults to 0.1.0
.
+version
: The version of the API.
-
url
: May be used to pass a canonical base URL for the schema.
schema_view = get_schema_view(
@@ -506,20 +510,20 @@ urlpatterns = [
urlconf='myproject.urls'
)
-
-
patterns
: List of url patterns to limit the schema introspection to. If you
only want the myproject.api
urls to be exposed in the schema:
-schema_url_patterns = [
+
schema_url_patterns = [
url(r'^api/', include('myproject.api.urls')),
-]
-schema_view = get_schema_view(
+]
+
+schema_view = get_schema_view(
title='Server Monitoring API',
url='https://www.example.org/api/',
patterns=schema_url_patterns,
-)
-
-
+)
+
generator_class
: May be used to specify a SchemaGenerator
subclass to be
@@ -563,7 +567,7 @@ schema = generator.get_schema()
The request
argument is optional, and may be used if you want to apply
per-user permissions to the resulting schema generation.
-This is a good point to override if you want to customise the generated
+
This is a good point to override if you want to customize the generated
dictionary, for example to add custom
specification extensions.
@@ -580,17 +584,17 @@ for each view, allowed method, and path.
Note: For basic APIView
subclasses, default introspection is essentially
limited to the URL kwarg path parameters. For GenericAPIView
subclasses, which includes all the provided class based views, AutoSchema
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
GenericAPIView
attributes and methods: get_serializer
, pagination_class
,
filter_backends
and so on.)
-In order to customise the operation generation, you should provide an AutoSchema
subclass, overriding get_operation()
as you need:
+In order to customize the operation generation, you should provide an AutoSchema
subclass, overriding get_operation()
as you need:
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):
diff --git a/api-guide/serializers/index.html b/api-guide/serializers/index.html
index 891c65d0c..dd4763d03 100644
--- a/api-guide/serializers/index.html
+++ b/api-guide/serializers/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
@@ -1305,10 +1309,10 @@ class BookSerializer(serializers.Serializer):
It's simple to create a read-only serializer for converting HighScore
instances into primitive data types.
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
}
We can now use this class to serialize single HighScore
instances:
@@ -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):
Improving serialization performance for a frequently accessed API endpoint that returns lots of data.
The signatures for these methods are as follows:
-
+
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.
-May be overridden in order modify the representation style. For example:
+May be overridden in order to modify the representation style. For example:
def to_representation(self, instance):
"""Convert `username` to lowercase."""
ret = super().to_representation(instance)
diff --git a/api-guide/settings/index.html b/api-guide/settings/index.html
index ad8bf1fbf..05e9ee0b6 100644
--- a/api-guide/settings/index.html
+++ b/api-guide/settings/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
@@ -552,7 +556,7 @@ print(api_settings.DEFAULT_AUTHENTICATION_CLASSES)
Default: 'rest_framework.negotiation.DefaultContentNegotiation'
A view inspector class that will be used for schema generation.
-Default: 'rest_framework.schemas.AutoSchema'
+Default: 'rest_framework.schemas.openapi.AutoSchema'
The following settings control the behavior of the generic class-based views.
diff --git a/api-guide/status-codes/index.html b/api-guide/status-codes/index.html
index 24e512db7..ce230d5b6 100644
--- a/api-guide/status-codes/index.html
+++ b/api-guide/status-codes/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/api-guide/testing/index.html b/api-guide/testing/index.html
index e50f1ed00..7cf0fc0d7 100644
--- a/api-guide/testing/index.html
+++ b/api-guide/testing/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/api-guide/throttling/index.html b/api-guide/throttling/index.html
index 51901a4ab..122cbb76d 100644
--- a/api-guide/throttling/index.html
+++ b/api-guide/throttling/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/api-guide/validators/index.html b/api-guide/validators/index.html
index 21da39eb6..ff562836c 100644
--- a/api-guide/validators/index.html
+++ b/api-guide/validators/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
@@ -717,12 +721,16 @@ to your Serializer
subclass. This is documented in the
message = 'This field must be a multiple of %d.' % self.base
raise serializers.ValidationError(message)
-
-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 set_context
method on a class-based validator.
-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
+
+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 requires_context = True
attribute on the validator. The __call__
method
+will then be called with the serializer_field
+or serializer
as an additional argument.
+requires_context = True
+
+def __call__(self, value, serializer_field):
+ ...
diff --git a/api-guide/versioning/index.html b/api-guide/versioning/index.html
index 8ee385363..f3572acd4 100644
--- a/api-guide/versioning/index.html
+++ b/api-guide/versioning/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
@@ -566,12 +570,12 @@ Accept: application/json
Your URL conf must include a pattern that matches the version with a 'version'
keyword argument, so that this information is available to the versioning scheme.
urlpatterns = [
- url(
+ re_path(
r'^(?P<version>(v1|v2))/bookings/$',
bookings_list,
name='bookings-list'
),
- url(
+ re_path(
r'^(?P<version>(v1|v2))/bookings/(?P<pk>[0-9]+)/$',
bookings_detail,
name='bookings-detail'
@@ -588,14 +592,14 @@ Accept: application/json
In the following example we're giving a set of views two different possible URL prefixes, each under a different namespace:
# bookings/urls.py
urlpatterns = [
- url(r'^$', bookings_list, name='bookings-list'),
- url(r'^(?P<pk>[0-9]+)/$', bookings_detail, name='bookings-detail')
+ re_path(r'^$', bookings_list, name='bookings-list'),
+ re_path(r'^(?P<pk>[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'))
]
Both URLPathVersioning
and NamespaceVersioning
are reasonable if you just need a simple versioning scheme. The URLPathVersioning
approach might be better suitable for small ad-hoc projects, and the NamespaceVersioning
is probably easier to manage for larger projects.
diff --git a/api-guide/views/index.html b/api-guide/views/index.html
index cc0ca8c3a..005ef1b83 100644
--- a/api-guide/views/index.html
+++ b/api-guide/views/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/api-guide/viewsets/index.html b/api-guide/viewsets/index.html
index 0009308a5..6943a7301 100644
--- a/api-guide/viewsets/index.html
+++ b/api-guide/viewsets/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/community/3.0-announcement/index.html b/community/3.0-announcement/index.html
index f3d79c8de..a87d0df90 100644
--- a/community/3.0-announcement/index.html
+++ b/community/3.0-announcement/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/community/3.1-announcement/index.html b/community/3.1-announcement/index.html
index 828c5585b..552ef386b 100644
--- a/community/3.1-announcement/index.html
+++ b/community/3.1-announcement/index.html
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
diff --git a/community/3.10-announcement/index.html b/community/3.10-announcement/index.html
index 7121370fc..ea4659d74 100644
--- a/community/3.10-announcement/index.html
+++ b/community/3.10-announcement/index.html
@@ -61,7 +61,7 @@
Next
-
+
Previous
Search
@@ -297,6 +297,10 @@
Release Notes
+
+ 3.11 Announcement
+
+
3.10 Announcement
@@ -508,7 +512,7 @@ urlpatterns = [
-For customizations that you want to apply across the the entire API, you can subclass rest_framework.schemas.openapi.SchemaGenerator
and provide it as an argument
+
For customizations that you want to apply across the entire API, you can subclass rest_framework.schemas.openapi.SchemaGenerator
and provide it as an argument
to the generateschema
command or get_schema_view()
helper function.
For specific per-view customizations, you can subclass AutoSchema
,
making sure to set schema = <YourCustomClass>
on the view.
@@ -537,7 +541,7 @@ on keeping any tooling outside of the core framework.
REST framework is a collaboratively funded project. If you use
REST framework commercially we strongly encourage you to invest in its
-continued development by signing up for a paid plan.
+continued development by signing up for a paid plan.
Every single sign-up helps us make REST framework long-term financially sustainable.