From 5e96a1ddf17946595a22083b035f99418dd2cbd7 Mon Sep 17 00:00:00 2001
From: Tom Christie The To set these attributes you should override the The The above function will apply any URL transformations appropriate to the request version. For example: This scheme requires the client to specify the version as part of the URL path. Date: 19th March 2015. Date: [5th March 2015][3.1.0-milestone]. Date: 5th March 2015. For full details see the 3.1 release announcement. Date: 10th February 2015.
-CursorPagination
class includes a number of attributes that may be overridden to modify the pagination style.CursorPagination
class, and then enable your custom pagination class as above.
-
page_size
= A numeric value indicating the page size. If set, this overrides the DEFAULT_PAGE_SIZE
setting. Defaults to the same value as the DEFAULT_PAGE_SIZE
settings key.page_size
= A numeric value indicating the page size. If set, this overrides the PAGE_SIZE
setting. Defaults to the same value as the PAGE_SIZE
settings key.cursor_query_param
= A string value indicating the name of the "cursor" query parameter. Defaults to 'cursor'
.ordering
= This should be a string, or list of strings, indicating the field against which the cursor based pagination will be applied. For example: ordering = 'slug'
. Defaults to -created
. This value may also be overridden by using OrderingFilter
on the view.template
= The name of a template to use when rendering pagination controls in the browsable API. May be overridden to modify the rendering style, or set to None
to disable HTML pagination controls completely. Defaults to "rest_framework/pagination/previous_and_next.html"
.Reversing URLs for versioned APIs
reverse
function included by REST framework ties in with the versioning scheme. You need to make sure to include the current request
as a keyword argument, like so.
-reverse('bookings-list', request=request)
+
from rest_framework.reverse import reverse
+
+reverse('bookings-list', request=request)
@@ -490,7 +492,7 @@ Accept: application/json; version=1.0
Host: example.com
Accept: application/vnd.megacorp.bookings+json; version=1.0
URLParameterVersioning
+URLPathVersioning
GET /v1/bookings/ HTTP/1.1
Host: example.com
diff --git a/topics/release-notes/index.html b/topics/release-notes/index.html
index 5e0a86b96..0a077d43e 100644
--- a/topics/release-notes/index.html
+++ b/topics/release-notes/index.html
@@ -411,8 +411,23 @@
3.0.x series
+3.1.1
+
+
serializer_class
is used, even when get_serializer
method does not exist on the view. (#2743)lookup_url_kwarg
handling in viewsets. (#2685, #2591)rest_framework.views
in apps.py
(#2678)TypeError
if PAGE_SIZE not set (#2667, #2700)min_value
field error message references max_value
. (#2645)MergeDict
. (#2640)3.1.0
-3.0.5
'snippet-detail'
.'url'
fields that by default will refer to '{model_name}-detail'
, which in this case will be 'snippet-detail'
and 'user-detail'
.After adding all those names into our URLconf, our final snippets/urls.py
file should look something like this:
After adding all those names into our URLconf, our final snippets/urls.py
file should look like this:
from django.conf.urls import url, include
+from rest_framework.urlpatterns import format_suffix_patterns
+from snippets import views
# API endpoints
urlpatterns = format_suffix_patterns([