2018-10-18 13:50:44 +03:00
<!DOCTYPE html>
< html lang = "en" >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=UTF-8" >
< meta charset = "utf-8" >
< title > 3.9 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.9-announcement/" / >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
< meta name = "description" content = "Django, API, REST, 3.9 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 >
2019-07-15 22:12:34 +03:00
< a class = "repo-link btn btn-inverse btn-small " rel = "next" href = "../3.8-announcement/" >
2018-10-18 13:50:44 +03:00
Next < i class = "icon-arrow-right icon-white" > < / i >
< / a >
2019-07-15 22:12:34 +03:00
< a class = "repo-link btn btn-inverse btn-small " rel = "prev" href = "../3.10-announcement/" >
2018-10-18 13:50:44 +03:00
< 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 >
2019-07-15 22:12:34 +03:00
< a href = "../.." > Home< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Tutorial < b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu" >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../tutorial/quickstart/" > Quickstart< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../tutorial/1-serialization/" > 1 - Serialization< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../tutorial/2-requests-and-responses/" > 2 - Requests and responses< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../tutorial/3-class-based-views/" > 3 - Class based views< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../tutorial/4-authentication-and-permissions/" > 4 - Authentication and permissions< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../tutorial/5-relationships-and-hyperlinked-apis/" > 5 - Relationships and hyperlinked APIs< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../tutorial/6-viewsets-and-routers/" > 6 - Viewsets and routers< / a >
2018-10-18 13:50:44 +03:00
< / 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 >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/requests/" > Requests< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/responses/" > Responses< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/views/" > Views< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/generic-views/" > Generic views< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/viewsets/" > Viewsets< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/routers/" > Routers< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/parsers/" > Parsers< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/renderers/" > Renderers< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/serializers/" > Serializers< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/fields/" > Serializer fields< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/relations/" > Serializer relations< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/validators/" > Validators< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/authentication/" > Authentication< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/permissions/" > Permissions< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/caching/" > Caching< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/throttling/" > Throttling< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/filtering/" > Filtering< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/pagination/" > Pagination< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/versioning/" > Versioning< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/content-negotiation/" > Content negotiation< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/metadata/" > Metadata< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/schemas/" > Schemas< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/format-suffixes/" > Format suffixes< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/reverse/" > Returning URLs< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/exceptions/" > Exceptions< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/status-codes/" > Status codes< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/testing/" > Testing< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../api-guide/settings/" > Settings< / a >
2018-10-18 13:50:44 +03:00
< / 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 >
2019-07-15 22:12:34 +03:00
< a href = "../../topics/documenting-your-api/" > Documenting your API< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../topics/api-clients/" > API Clients< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../topics/internationalization/" > Internationalization< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../topics/ajax-csrf-cors/" > AJAX, CSRF & CORS< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../topics/html-and-forms/" > HTML & Forms< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../topics/browser-enhancements/" > Browser Enhancements< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../topics/browsable-api/" > The Browsable API< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../topics/rest-hypermedia-hateoas/" > REST, Hypermedia & HATEOAS< / a >
2018-10-18 13:50:44 +03:00
< / 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 >
2019-07-15 22:12:34 +03:00
< a href = "../tutorials-and-resources/" > Tutorials and Resources< / a >
2019-07-15 14:38:39 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../third-party-packages/" > Third Party Packages< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../contributing/" > Contributing to REST framework< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../project-management/" > Project management< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../release-notes/" > Release Notes< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../3.10-announcement/" > 3.10 Announcement< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li class = "active" >
2019-07-15 22:12:34 +03:00
< a href = "./" > 3.9 Announcement< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../3.8-announcement/" > 3.8 Announcement< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../3.7-announcement/" > 3.7 Announcement< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../3.6-announcement/" > 3.6 Announcement< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../3.5-announcement/" > 3.5 Announcement< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../3.4-announcement/" > 3.4 Announcement< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../3.3-announcement/" > 3.3 Announcement< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../3.2-announcement/" > 3.2 Announcement< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../3.1-announcement/" > 3.1 Announcement< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../3.0-announcement/" > 3.0 Announcement< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../kickstarter-announcement/" > Kickstarter Announcement< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../mozilla-grant/" > Mozilla Grant< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../funding/" > Funding< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../jobs/" > Jobs< / a >
2018-10-18 13:50:44 +03:00
< / 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" > × < / 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" >
2019-07-15 22:12:34 +03:00
< a href = "../../#django-rest-framework-39" > Django REST framework 3.9< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../#funding" > Funding< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../#built-in-openapi-schema-support" > Built-in OpenAPI schema support< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../#composable-permission-classes" > Composable permission classes< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../#viewset-extra-actions-available-in-the-browsable-api" > ViewSet Extra Actions available in the Browsable API< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../#supported-versions" > Supported Versions< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../#deprecations" > Deprecations< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../#minor-fixes-and-improvements" > Minor fixes and improvements< / a >
2018-10-18 13:50:44 +03:00
< / li >
< li >
2019-07-15 22:12:34 +03:00
< a href = "../../#whats-next" > What's next< / a >
2018-10-18 13:50:44 +03:00
< / 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-39" > < a class = "toclink" href = "#django-rest-framework-39" > Django REST framework 3.9< / a > < / h1 >
< p > The 3.9 release gives access to < em > extra actions< / em > in the Browsable API, introduces composable permissions and built-in < a href = "https://www.openapis.org/" > OpenAPI< / a > schema support. (Formerly known as Swagger)< / p >
< hr / >
< h2 id = "funding" > < a class = "toclink" href = "#funding" > Funding< / a > < / h2 >
< p > If you use REST framework commercially and would like to see this work continue, we strongly encourage you to invest in its continued development by
< strong > < a href = "../funding/" > signing up for a paid plan< / a > < / strong > .< / p >
< ul class = "premium-promo promo" >
2019-01-16 16:29:55 +03:00
< li > < a href = "https://www.rover.com/careers/" style = "background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)" > Rover.com< / a > < / li >
< li > < a href = "https://sentry.io/welcome/" style = "background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)" > Sentry< / a > < / li >
2018-10-18 13:50:44 +03:00
< 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://auklet.io" style = "background-image: url(https://fund-rest-framework.s3.amazonaws.com/auklet-new.png)" > Auklet< / 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://loadimpact.com/?utm_campaign=Sponsorship%20links&utm_source=drf&utm_medium=drf" style = "background-image: url(https://fund-rest-framework.s3.amazonaws.com/load-impact.png)" > Load Impact< / a > < / li >
< li > < a href = "https://hubs.ly/H0f30Lf0" style = "background-image: url(https://fund-rest-framework.s3.amazonaws.com/kloudless.png)" > Kloudless< / a > < / li >
< / ul >
< div style = "clear: both; padding-bottom: 20px;" > < / div >
2019-01-16 16:29:55 +03:00
< 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://www.rover.com/careers/" > Rover< / a > , < a href = "https://sentry.io/welcome/" > Sentry< / a > , < a href = "https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf" > Stream< / a > , < a href = "https://auklet.io/" > Auklet< / a > , < a href = "https://rollbar.com" > Rollbar< / a > , < a href = "https://cadre.com" > Cadre< / a > , < a href = "https://loadimpact.com/?utm_campaign=Sponsorship%20links&utm_source=drf&utm_medium=drf" > Load Impact< / a > , and < a href = "https://hubs.ly/H0f30Lf0" > Kloudless< / a > .< / em > < / p >
2018-10-18 13:50:44 +03:00
< hr / >
< h2 id = "built-in-openapi-schema-support" > < a class = "toclink" href = "#built-in-openapi-schema-support" > Built-in OpenAPI schema support< / a > < / h2 >
< p > REST framework now has a first-pass at directly including OpenAPI schema support. (Formerly known as Swagger)< / p >
< p > Specifically:< / p >
< ul >
< li > There are now < code > OpenAPIRenderer< / code > , and < code > JSONOpenAPIRenderer< / code > classes that deal with encoding < code > coreapi.Document< / code > instances into OpenAPI YAML or OpenAPI JSON.< / li >
< li > The < code > get_schema_view(...)< / code > method now defaults to OpenAPI YAML, with CoreJSON as a secondary
option if it is selected via HTTP content negotiation.< / li >
< li > There is a new management command < code > generateschema< / code > , which you can use to dump
the schema into your repository.< / li >
< / ul >
< p > Here's an example of adding an OpenAPI schema to the URL conf:< / p >
< pre > < code class = "python" > from rest_framework.schemas import get_schema_view
from rest_framework.renderers import JSONOpenAPIRenderer
schema_view = get_schema_view(
title='Server Monitoring API',
url='https://www.example.org/api/',
renderer_classes=[JSONOpenAPIRenderer]
)
urlpatterns = [
url('^schema.json$', schema_view),
...
]
< / code > < / pre >
< p > And here's how you can use the < code > generateschema< / code > management command:< / p >
< pre > < code class = "shell" > $ python manage.py generateschema --format openapi > schema.yml
< / code > < / pre >
< p > There's lots of different tooling that you can use for working with OpenAPI
schemas. One option that we're working on is the < a href = "https://docs.apistar.com/" > API Star< / a >
command line tool.< / p >
< p > You can use < code > apistar< / code > to validate your API schema:< / p >
< pre > < code class = "shell" > $ apistar validate --path schema.json --format openapi
✓ Valid OpenAPI schema.
< / code > < / pre >
< p > Or to build API documentation:< / p >
< pre > < code class = "shell" > $ apistar docs --path schema.json --format openapi
✓ Documentation built at " build/index.html" .
< / code > < / pre >
< p > API Star also includes a < a href = "https://docs.apistar.com/client-library/" > dynamic client library< / a >
that uses an API schema to automatically provide a client library interface for making requests.< / p >
< h2 id = "composable-permission-classes" > < a class = "toclink" href = "#composable-permission-classes" > Composable permission classes< / a > < / h2 >
< p > You can now compose permission classes using the and/or operators, < code > & < / code > and < code > |< / code > .< / p >
< p > For example...< / p >
< pre > < code class = "python" > permission_classes = [IsAuthenticated & (ReadOnly | IsAdmin)]
< / code > < / pre >
< p > If you're using custom permission classes then make sure that you are subclassing
from < code > BasePermission< / code > in order to enable this support.< / p >
< h2 id = "viewset-extra-actions-available-in-the-browsable-api" > < a class = "toclink" href = "#viewset-extra-actions-available-in-the-browsable-api" > ViewSet < em > Extra Actions< / em > available in the Browsable API< / a > < / h2 >
< p > Following the introduction of the < code > action< / code > decorator in v3.8, < em > extra actions< / em > defined on a ViewSet are now available
from the Browsable API.< / p >
< p > < img alt = "Extra Actions displayed in the Browsable API" src = "https://user-images.githubusercontent.com/2370209/32976956-1ca9ab7e-cbf1-11e7-981a-a20cb1e83d63.png" / > < / p >
< p > When defined, a dropdown of "Extra Actions", appropriately filtered to detail/non-detail actions, is displayed.< / p >
< hr / >
< h2 id = "supported-versions" > < a class = "toclink" href = "#supported-versions" > Supported Versions< / a > < / h2 >
< p > REST framework 3.9 supports Django versions 1.11, 2.0, and 2.1.< / p >
< hr / >
< h2 id = "deprecations" > < a class = "toclink" href = "#deprecations" > Deprecations< / a > < / h2 >
< h3 id = "djangoobjectpermissionsfilter-moved-to-third-party-package" > < a class = "toclink" href = "#djangoobjectpermissionsfilter-moved-to-third-party-package" > < code > DjangoObjectPermissionsFilter< / code > moved to third-party package.< / a > < / h3 >
< p > The < code > DjangoObjectPermissionsFilter< / code > class is pending deprecation, will be deprecated in 3.10 and removed entirely in 3.11.< / p >
< p > It has been moved to the third-party < a href = "https://github.com/rpkilby/django-rest-framework-guardian" > < code > djangorestframework-guardian< / code > < / a >
package. Please use this instead.< / p >
< h3 id = "router-argumentmethod-renamed-to-use-basename-for-consistency" > < a class = "toclink" href = "#router-argumentmethod-renamed-to-use-basename-for-consistency" > Router argument/method renamed to use < code > basename< / code > for consistency.< / a > < / h3 >
< ul >
< li > The < code > Router.register< / code > < code > base_name< / code > argument has been renamed in favor of < code > basename< / code > .< / li >
< li > The < code > Router.get_default_base_name< / code > method has been renamed in favor of < code > Router.get_default_basename< / code > . < a href = "https://github.com/encode/django-rest-framework/pull/5990" > #5990< / a > < / li >
< / ul >
< p > See < a href = "https://github.com/encode/django-rest-framework/pull/5990" > #5990< / a > .< / p >
< p > < code > base_name< / code > and < code > get_default_base_name()< / code > are pending deprecation. They will be deprecated in 3.10 and removed entirely in 3.11.< / p >
< h3 id = "action-decorator-replaces-list_route-and-detail_route" > < a class = "toclink" href = "#action-decorator-replaces-list_route-and-detail_route" > < code > action< / code > decorator replaces < code > list_route< / code > and < code > detail_route< / code > < / a > < / h3 >
< p > Both < code > list_route< / code > and < code > detail_route< / code > are now deprecated in favour of the single < code > action< / code > decorator.
They will be removed entirely in 3.10.< / p >
< p > The < code > action< / code > decorator takes a boolean < code > detail< / code > argument.< / p >
< ul >
< li > Replace < code > detail_route< / code > uses with < code > @action(detail=True)< / code > .< / li >
< li > Replace < code > list_route< / code > uses with < code > @action(detail=False)< / code > .< / li >
< / ul >
< h3 id = "exclude_from_schema" > < a class = "toclink" href = "#exclude_from_schema" > < code > exclude_from_schema< / code > < / a > < / h3 >
< p > Both < code > APIView.exclude_from_schema< / code > and the < code > exclude_from_schema< / code > argument to the < code > @api_view< / code > have now been removed.< / p >
< p > For < code > APIView< / code > you should instead set a < code > schema = None< / code > attribute on the view class.< / p >
2018-11-15 16:53:15 +03:00
< p > For function-based views the < code > @schema< / code > decorator can be used to exclude the view from the schema, by using < code > @schema(None)< / code > .< / p >
2018-10-18 13:50:44 +03:00
< hr / >
< h2 id = "minor-fixes-and-improvements" > < a class = "toclink" href = "#minor-fixes-and-improvements" > Minor fixes and improvements< / a > < / h2 >
< p > There are a large number of minor fixes and improvements in this release. See the < a href = "../release-notes/" > release notes< / a > page for a complete listing.< / p >
< h2 id = "whats-next" > < a class = "toclink" href = "#whats-next" > What's next< / a > < / h2 >
2018-11-15 16:53:15 +03:00
< p > We're planning to iteratively work towards OpenAPI becoming the standard schema
2018-10-18 13:50:44 +03:00
representation. This will mean that the < code > coreapi< / code > dependency will gradually become
removed, and we'll instead generate the schema directly, rather than building
a CoreAPI < code > Document< / code > object.< / p >
< p > OpenAPI has clearly become the standard for specifying Web APIs, so there's not
much value any more in our schema-agnostic document model. Making this change
will mean that we'll more easily be able to take advantage of the full set of
OpenAPI functionality.< / p >
< p > This will also make a wider range of tooling available.< / p >
< p > We'll focus on continuing to develop the < a href = "https://docs.apistar.com/" > API Star< / a >
library and client tool into a recommended option for generating API docs,
validating API schemas, and providing a dynamic client library.< / p >
< p > There's also a huge amount of ongoing work on maturing the ASGI landscape,
with the possibility that some of this work will eventually < a href = "https://www.aeracode.org/2018/06/04/django-async-roadmap/" > feed back into
Django< / a > .< / p >
< p > There will be further work on the < a href = "https://www.uvicorn.org/" > Uvicorn< / a >
2018-11-15 16:53:15 +03:00
web server, as well as lots of functionality planned for the < a href = "https://www.starlette.io/" > Starlette< / a >
2018-10-18 13:50:44 +03:00
web framework, which is building a foundational set of tooling for working with
ASGI.< / p >
< / div > <!-- /span -->
< / div > <!-- /row -->
< / div > <!-- /.fluid - container -->
< / div > <!-- /.body content -->
< div id = "push" > < / div >
< / div > <!-- /.wrapper -->
< footer class = "span12" >
< p > Documentation built with < a href = "http://www.mkdocs.org/" > MkDocs< / a > .
< / p >
< / footer >
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
< script src = "../../js/jquery-1.8.1-min.js" > < / script >
< script src = "../../js/prettify-1.0.js" > < / script >
< script src = "../../js/bootstrap-2.1.1-min.js" > < / script >
2019-06-04 14:04:28 +03:00
< script async src = "https://fund.django-rest-framework.org/sidebar_include.js" > < / script >
2018-10-18 13:50:44 +03:00
< script > var base _url = '../..' ; < / script >
< script src = "../../mkdocs/js/require.js" > < / script >
< script src = "../../js/theme.js" > < / script >
< script >
var shiftWindow = function() {
scrollBy(0, -50)
};
if (location.hash) shiftWindow();
window.addEventListener("hashchange", shiftWindow);
$('.dropdown-menu').on('click touchstart', function(event) {
event.stopPropagation();
});
// Dynamically force sidenav/dropdown to no higher than browser window
$('.side-nav, .dropdown-menu').css('max-height', window.innerHeight - 130);
$(function() {
$(window).resize(function() {
$('.side-nav, .dropdown-menu').css('max-height', window.innerHeight - 130);
});
});
< / script >
< / body >
< / html >