Deployed 1c3f7962 with MkDocs version: 0.16.3

This commit is contained in:
Tom Christie 2018-10-11 13:48:33 +00:00
parent 8e48be4343
commit 27743fc266
71 changed files with 4711 additions and 3399 deletions

View File

@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="/topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="/topics/third-party-packages/">Third Party Packages</a>
<a href="/community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="/topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="/community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="/topics/contributing/">Contributing to REST framework</a>
<a href="/community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="/topics/project-management/">Project management</a>
<a href="/community/project-management/">Project management</a>
</li>
<li >
<a href="/topics/jobs/">Jobs</a>
<a href="/community/release-notes/">Release Notes</a>
</li>
<li >
<a href="/topics/3.0-announcement/">3.0 Announcement</a>
<a href="/community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="/topics/3.1-announcement/">3.1 Announcement</a>
<a href="/community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="/topics/3.2-announcement/">3.2 Announcement</a>
<a href="/community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="/topics/3.3-announcement/">3.3 Announcement</a>
<a href="/community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="/topics/3.4-announcement/">3.4 Announcement</a>
<a href="/community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="/topics/3.5-announcement/">3.5 Announcement</a>
<a href="/community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="/topics/3.6-announcement/">3.6 Announcement</a>
<a href="/community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="/topics/3.7-announcement/">3.7 Announcement</a>
<a href="/community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="/topics/3.8-announcement/">3.8 Announcement</a>
<a href="/community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="/topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="/community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="/topics/mozilla-grant/">Mozilla Grant</a>
<a href="/community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="/topics/funding/">Funding</a>
<a href="/community/funding/">Funding</a>
</li>
<li >
<a href="/topics/release-notes/">Release Notes</a>
<a href="/community/jobs/">Jobs</a>
</li>
</ul>
@ -400,7 +411,7 @@
<h1 id="404-page-not-found" style="text-align: center">404</h1>
<p style="text-align: center"><strong>Page not found</strong></p>
<p style="text-align: center">Try the <a href="http://www.django-rest-framework.org/">homepage</a>, or <a href="#searchModal" data-toggle="modal">search the documentation</a>.</p>
<p style="text-align: center">Try the <a href="https://www.django-rest-framework.org/">homepage</a>, or <a href="#searchModal" data-toggle="modal">search the documentation</a>.</p>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Authentication - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/authentication/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/authentication/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Authentication">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -456,10 +467,6 @@
<a href="#digest-authentication">Digest Authentication</a>
</li>
<li>
<a href="#django-oauth2-consumer">Django OAuth2 Consumer</a>
</li>
<li>
<a href="#json-web-token-authentication">JSON Web Token Authentication</a>
</li>
@ -801,14 +808,12 @@ REST_FRAMEWORK = {
<p>For details on configuration and usage see the Django REST framework OAuth documentation for <a href="https://jpadilla.github.io/django-rest-framework-oauth/authentication/">authentication</a> and <a href="https://jpadilla.github.io/django-rest-framework-oauth/permissions/">permissions</a>.</p>
<h2 id="digest-authentication"><a class="toclink" href="#digest-authentication">Digest Authentication</a></h2>
<p>HTTP digest authentication is a widely implemented scheme that was intended to replace HTTP basic authentication, and which provides a simple encrypted authentication mechanism. <a href="https://github.com/juanriaza">Juan Riaza</a> maintains the <a href="https://github.com/juanriaza/django-rest-framework-digestauth">djangorestframework-digestauth</a> package which provides HTTP digest authentication support for REST framework.</p>
<h2 id="django-oauth2-consumer"><a class="toclink" href="#django-oauth2-consumer">Django OAuth2 Consumer</a></h2>
<p>The <a href="https://github.com/Rediker-Software/doac">Django OAuth2 Consumer</a> library from <a href="https://github.com/Rediker-Software">Rediker Software</a> is another package that provides <a href="https://github.com/Rediker-Software/doac/blob/master/docs/integrations.md#">OAuth 2.0 support for REST framework</a>. The package includes token scoping permissions on tokens, which allows finer-grained access to your API.</p>
<h2 id="json-web-token-authentication"><a class="toclink" href="#json-web-token-authentication">JSON Web Token Authentication</a></h2>
<p>JSON Web Token is a fairly new standard which can be used for token-based authentication. Unlike the built-in TokenAuthentication scheme, JWT Authentication doesn't need to use a database to validate a token. <a href="https://github.com/GetBlimp">Blimp</a> maintains the <a href="https://github.com/GetBlimp/django-rest-framework-jwt">djangorestframework-jwt</a> package which provides a JWT Authentication class as well as a mechanism for clients to obtain a JWT given the username and password. An alternative package for JWT authentication is <a href="https://github.com/davesque/django-rest-framework-simplejwt">djangorestframework-simplejwt</a> which provides different features as well as a pluggable token blacklist app.</p>
<p>JSON Web Token is a fairly new standard which can be used for token-based authentication. Unlike the built-in TokenAuthentication scheme, JWT Authentication doesn't need to use a database to validate a token. A package for JWT authentication is <a href="https://github.com/davesque/django-rest-framework-simplejwt">djangorestframework-simplejwt</a> which provides some features as well as a pluggable token blacklist app.</p>
<h2 id="hawk-http-authentication"><a class="toclink" href="#hawk-http-authentication">Hawk HTTP Authentication</a></h2>
<p>The <a href="https://hawkrest.readthedocs.io/en/latest/">HawkREST</a> library builds on the <a href="https://mohawk.readthedocs.io/en/latest/">Mohawk</a> library to let you work with <a href="https://github.com/hueniverse/hawk">Hawk</a> signed requests and responses in your API. <a href="https://github.com/hueniverse/hawk">Hawk</a> lets two parties securely communicate with each other using messages signed by a shared key. It is based on <a href="https://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token-05">HTTP MAC access authentication</a> (which was based on parts of <a href="https://oauth.net/core/1.0a/">OAuth 1.0</a>).</p>
<h2 id="http-signature-authentication"><a class="toclink" href="#http-signature-authentication">HTTP Signature Authentication</a></h2>
<p>HTTP Signature (currently a <a href="https://datatracker.ietf.org/doc/draft-cavage-http-signatures/">IETF draft</a>) provides a way to achieve origin authentication and message integrity for HTTP messages. Similar to <a href="https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html">Amazon's HTTP Signature scheme</a>, used by many of its services, it permits stateless, per-request authentication. <a href="https://github.com/etoccalino/">Elvio Toccalino</a> maintains the <a href="https://github.com/etoccalino/django-rest-framework-httpsignature">djangorestframework-httpsignature</a> package which provides an easy to use HTTP Signature Authentication mechanism.</p>
<p>HTTP Signature (currently a <a href="https://datatracker.ietf.org/doc/draft-cavage-http-signatures/">IETF draft</a>) provides a way to achieve origin authentication and message integrity for HTTP messages. Similar to <a href="https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html">Amazon's HTTP Signature scheme</a>, used by many of its services, it permits stateless, per-request authentication. <a href="https://github.com/etoccalino/">Elvio Toccalino</a> maintains the <a href="https://github.com/etoccalino/django-rest-framework-httpsignature">djangorestframework-httpsignature</a> (outdated) package which provides an easy to use HTTP Signature Authentication mechanism. You can use the updated fork version of <a href="https://github.com/etoccalino/django-rest-framework-httpsignature">djangorestframework-httpsignature</a>, which is <a href="https://github.com/ahknight/drf-httpsig">drf-httpsig</a>.</p>
<h2 id="djoser"><a class="toclink" href="#djoser">Djoser</a></h2>
<p><a href="https://github.com/sunscrapers/djoser">Djoser</a> library provides a set of views to handle basic actions such as registration, login, logout, password reset and account activation. The package works with a custom user model and it uses token based authentication. This is a ready to use REST implementation of Django authentication system.</p>
<h2 id="django-rest-auth"><a class="toclink" href="#django-rest-auth">django-rest-auth</a></h2>

View File

@ -0,0 +1,514 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>Caching - 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/api-guide/caching/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Caching">
<meta name="author" content="Tom Christie">
<!-- Le styles -->
<link href="../../css/prettify.css" rel="stylesheet">
<link href="../../css/bootstrap.css" rel="stylesheet">
<link href="../../css/bootstrap-responsive.css" rel="stylesheet">
<link href="../../css/default.css" rel="stylesheet">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-18852272-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
<style>
#sidebarInclude img {
margin-bottom: 10px;
}
#sidebarInclude a.promo {
color: black;
}
@media (max-width: 767px) {
div.promo {
display: none;
}
}
</style>
</head>
<body onload="prettyPrint()" class="-page">
<div class="wrapper">
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../throttling/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../permissions/">
<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>
<li >
<a href="../../tutorial/7-schemas-and-client-libraries/">7 - Schemas and client libraries</a>
</li>
</ul>
</li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">API Guide <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../requests/">Requests</a>
</li>
<li >
<a href="../responses/">Responses</a>
</li>
<li >
<a href="../views/">Views</a>
</li>
<li >
<a href="../generic-views/">Generic views</a>
</li>
<li >
<a href="../viewsets/">Viewsets</a>
</li>
<li >
<a href="../routers/">Routers</a>
</li>
<li >
<a href="../parsers/">Parsers</a>
</li>
<li >
<a href="../renderers/">Renderers</a>
</li>
<li >
<a href="../serializers/">Serializers</a>
</li>
<li >
<a href="../fields/">Serializer fields</a>
</li>
<li >
<a href="../relations/">Serializer relations</a>
</li>
<li >
<a href="../validators/">Validators</a>
</li>
<li >
<a href="../authentication/">Authentication</a>
</li>
<li >
<a href="../permissions/">Permissions</a>
</li>
<li class="active" >
<a href="./">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
<li >
<a href="../filtering/">Filtering</a>
</li>
<li >
<a href="../pagination/">Pagination</a>
</li>
<li >
<a href="../versioning/">Versioning</a>
</li>
<li >
<a href="../content-negotiation/">Content negotiation</a>
</li>
<li >
<a href="../metadata/">Metadata</a>
</li>
<li >
<a href="../schemas/">Schemas</a>
</li>
<li >
<a href="../format-suffixes/">Format suffixes</a>
</li>
<li >
<a href="../reverse/">Returning URLs</a>
</li>
<li >
<a href="../exceptions/">Exceptions</a>
</li>
<li >
<a href="../status-codes/">Status codes</a>
</li>
<li >
<a href="../testing/">Testing</a>
</li>
<li >
<a href="../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">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../community/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="#caching">Caching</a>
</li>
<li>
<a href="#using-cache-with-apiview-and-viewsets">Using cache with apiview and viewsets</a>
</li>
<div class="promo">
<hr/>
<div id="sidebarInclude">
</div>
</ul>
</div>
</div>
<div id="main-content" class="span9">
<h1 id="caching"><a class="toclink" href="#caching">Caching</a></h1>
<blockquote>
<p>A certain woman had a very sharp conciousness but almost no
memory ... She remembered enough to work, and she worked hard.
- Lydia Davis</p>
</blockquote>
<p>Caching in REST Framework works well with the cache utilities
provided in Django.</p>
<hr />
<h2 id="using-cache-with-apiview-and-viewsets"><a class="toclink" href="#using-cache-with-apiview-and-viewsets">Using cache with apiview and viewsets</a></h2>
<p>Django provides a <a href="https://docs.djangoproject.com/en/dev/topics/class-based-views/intro/#decorating-the-class"><code>method_decorator</code></a> to use
decorators with class based views. This can be used with
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
from rest_framework.views import APIView
from rest_framework import viewsets
class UserViewSet(viewsets.Viewset):
# Cache requested url for each user for 2 hours
@method_decorator(cache_page(60*60*2))
@method_decorator(vary_on_cookie)
def list(self, request, format=None):
content = {
'user_feed': request.user.get_user_feed()
}
return Response(content)
class PostView(APIView):
# Cache page for the requested url
@method_decorator(cache_page(60*60*2))
def get(self, request, format=None):
content = {
'title': 'Post title',
'body': 'Post content'
}
return Response(content)
</code></pre>
<p><strong>NOTE:</strong> The <a href="https://docs.djangoproject.com/en/dev/topics/cache/#the-per-view-cache"><code>cache_page</code></a> decorator only caches the
<code>GET</code> and <code>HEAD</code> responses with status 200.</p>
</div> <!--/span-->
</div> <!--/row-->
</div> <!--/.fluid-container-->
</div> <!--/.body content-->
<div id="push"></div>
</div> <!--/.wrapper -->
<footer class="span12">
<p>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.
</p>
</footer>
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../../js/jquery-1.8.1-min.js"></script>
<script src="../../js/prettify-1.0.js"></script>
<script src="../../js/bootstrap-2.1.1-min.js"></script>
<script src="https://fund.django-rest-framework.org/sidebar_include.js"></script>
<script>var base_url = '../..';</script>
<script src="../../mkdocs/js/require.js"></script>
<script src="../../js/theme.js"></script>
<script>
var shiftWindow = function() {
scrollBy(0, -50)
};
if (location.hash) shiftWindow();
window.addEventListener("hashchange", shiftWindow);
$('.dropdown-menu').on('click touchstart', function(event) {
event.stopPropagation();
});
// Dynamically force sidenav/dropdown to no higher than browser window
$('.side-nav, .dropdown-menu').css('max-height', window.innerHeight - 130);
$(function() {
$(window).resize(function() {
$('.side-nav, .dropdown-menu').css('max-height', window.innerHeight - 130);
});
});
</script>
</body>
</html>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Content negotiation - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/content-negotiation/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/content-negotiation/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Content negotiation">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Exceptions - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/exceptions/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/exceptions/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Exceptions">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -459,7 +470,7 @@
</li>
<li>
<a href="#rest_frameworkexceptionsserver_error_1">rest_framework.exceptions.server_error</a>
<a href="#rest_frameworkexceptionsbad_request">rest_framework.exceptions.bad_request</a>
</li>
@ -654,7 +665,7 @@ API-only application.)</p>
<p>Set as <code>handler500</code>:</p>
<pre><code>handler500 = 'rest_framework.exceptions.server_error'
</code></pre>
<h2 id="rest_frameworkexceptionsserver_error_1"><a class="toclink" href="#rest_frameworkexceptionsserver_error_1"><code>rest_framework.exceptions.server_error</code></a></h2>
<h2 id="rest_frameworkexceptionsbad_request"><a class="toclink" href="#rest_frameworkexceptionsbad_request"><code>rest_framework.exceptions.bad_request</code></a></h2>
<p>Returns a response with status code <code>400</code> and <code>application/json</code> content type.</p>
<p>Set as <code>handler400</code>:</p>
<pre><code>handler400 = 'rest_framework.exceptions.bad_request'

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Serializer fields - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/fields/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/fields/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Serializer fields">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -817,7 +828,7 @@ color_channel = serializers.ChoiceField(
<h4 id="datetimefield-format-strings"><a class="toclink" href="#datetimefield-format-strings"><code>DateTimeField</code> format strings.</a></h4>
<p>Format strings may either be <a href="https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior">Python strftime formats</a> which explicitly specify the format, or the special string <code>'iso-8601'</code>, which indicates that <a href="https://www.w3.org/TR/NOTE-datetime">ISO 8601</a> style datetimes should be used. (eg <code>'2013-01-29T12:34:56.000000Z'</code>)</p>
<p>When a value of <code>None</code> is used for the format <code>datetime</code> objects will be returned by <code>to_representation</code> and the final output representation will determined by the renderer class.</p>
<h4 id="auto_now-and-auto_now_add-model-fields"><code>auto_now_add</code> model fields.<a class="toclink" href="#auto_now-and-auto_now_add-model-fields"><code>auto_now</code> and </a></h4>
<h4 id="auto_now-and-auto_now_add-model-fields"><a class="toclink" href="#auto_now-and-auto_now_add-model-fields"><code>auto_now</code> and <code>auto_now_add</code> model fields.</a></h4>
<p>When using <code>ModelSerializer</code> or <code>HyperlinkedModelSerializer</code>, note that any model fields with <code>auto_now=True</code> or <code>auto_now_add=True</code> will use serializer fields that are <code>read_only=True</code> by default.</p>
<p>If you want to override this behavior, you'll need to declare the <code>DateTimeField</code> explicitly on the serializer. For example:</p>
<pre><code>class CommentSerializer(serializers.ModelSerializer):
@ -851,7 +862,11 @@ color_channel = serializers.ChoiceField(
Corresponds to <code>django.db.models.fields.DurationField</code></p>
<p>The <code>validated_data</code> for these fields will contain a <code>datetime.timedelta</code> instance.
The representation is a string following this format <code>'[DD] [HH:[MM:]]ss[.uuuuuu]'</code>.</p>
<p><strong>Signature:</strong> <code>DurationField()</code></p>
<p><strong>Signature:</strong> <code>DurationField(max_value=None, min_value=None)</code></p>
<ul>
<li><code>max_value</code> Validate that the duration provided is no greater than this value.</li>
<li><code>min_value</code> Validate that the duration provided is no less than this value.</li>
</ul>
<hr />
<h1 id="choice-selection-fields"><a class="toclink" href="#choice-selection-fields">Choice selection fields</a></h1>
<h2 id="choicefield"><a class="toclink" href="#choicefield">ChoiceField</a></h2>
@ -1012,8 +1027,8 @@ class ColorField(serializers.Field):
"""
Color objects are serialized into 'rgb(#, #, #)' notation.
"""
def to_representation(self, obj):
return "rgb(%d, %d, %d)" % (obj.red, obj.green, obj.blue)
def to_representation(self, value):
return "rgb(%d, %d, %d)" % (value.red, value.green, value.blue)
def to_internal_value(self, data):
data = data.strip('rgb(').rstrip(')')
@ -1023,16 +1038,16 @@ class ColorField(serializers.Field):
<p>By default field values are treated as mapping to an attribute on the object. If you need to customize how the field value is accessed and set you need to override <code>.get_attribute()</code> and/or <code>.get_value()</code>.</p>
<p>As an example, let's create a field that can be used to represent the class name of the object being serialized:</p>
<pre><code>class ClassNameField(serializers.Field):
def get_attribute(self, obj):
def get_attribute(self, instance):
# We pass the object instance onto `to_representation`,
# not just the field attribute.
return obj
return instance
def to_representation(self, obj):
def to_representation(self, value):
"""
Serialize the object's class name.
Serialize the value's class name.
"""
return obj.__class__.__name__
return value.__class__.__name__
</code></pre>
<h3 id="raising-validation-errors"><a class="toclink" href="#raising-validation-errors">Raising validation errors</a></h3>
<p>Our <code>ColorField</code> class above currently does not perform any data validation.
@ -1087,10 +1102,10 @@ def to_internal_value(self, data):
the coordinate pair:</p>
<pre><code>class CoordinateField(serializers.Field):
def to_representation(self, obj):
def to_representation(self, value):
ret = {
"x": obj.x_coordinate,
"y": obj.y_coordinate
"x": value.x_coordinate,
"y": value.y_coordinate
}
return ret

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Filtering - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/filtering/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/filtering/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Filtering">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -645,7 +656,9 @@ It's also recommended that you read the section on <a href="https://django-filte
<p>When in use, the browsable API will include a <code>SearchFilter</code> control:</p>
<p><img alt="Search Filter" src="../../img/search-filter.png" /></p>
<p>The <code>SearchFilter</code> class will only be applied if the view has a <code>search_fields</code> attribute set. The <code>search_fields</code> attribute should be a list of names of text type fields on the model, such as <code>CharField</code> or <code>TextField</code>.</p>
<pre><code>class UserListView(generics.ListAPIView):
<pre><code>from rest_framework import filters
class UserListView(generics.ListAPIView):
queryset = User.objects.all()
serializer_class = UserSerializer
filter_backends = (filters.SearchFilter,)
@ -715,6 +728,9 @@ It's also recommended that you read the section on <a href="https://django-filte
<hr />
<h2 id="djangoobjectpermissionsfilter"><a class="toclink" href="#djangoobjectpermissionsfilter">DjangoObjectPermissionsFilter</a></h2>
<p>The <code>DjangoObjectPermissionsFilter</code> is intended to be used together with the <a href="https://django-guardian.readthedocs.io/"><code>django-guardian</code></a> package, with custom <code>'view'</code> permissions added. The filter will ensure that querysets only returns objects for which the user has the appropriate view permission.</p>
<hr />
<p><strong>Note:</strong> This filter has been deprecated as of version 3.9 and moved to the 3rd-party <a href="https://github.com/rpkilby/django-rest-framework-guardian"><code>djangorestframework-guardian</code> package</a>.</p>
<hr />
<p>If you're using <code>DjangoObjectPermissionsFilter</code>, you'll probably also want to add an appropriate object permissions class, to ensure that users can only operate on instances if they have the appropriate object permissions. The easiest way to do this is to subclass <code>DjangoObjectPermissions</code> and add <code>'view'</code> permissions to the <code>perms_map</code> attribute.</p>
<p>A complete example using both <code>DjangoObjectPermissionsFilter</code> and <code>DjangoObjectPermissions</code> might look something like this.</p>
<p><strong>permissions.py</strong>:</p>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Format suffixes - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/format-suffixes/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/format-suffixes/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Format suffixes">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -486,7 +497,7 @@ urlpatterns = i18n_patterns(
<h2 id="accept-headers-vs-format-suffixes"><a class="toclink" href="#accept-headers-vs-format-suffixes">Accept headers vs. format suffixes</a></h2>
<p>There seems to be a view among some of the Web community that filename extensions are not a RESTful pattern, and that <code>HTTP Accept</code> headers should always be used instead.</p>
<p>It is actually a misconception. For example, take the following quote from Roy Fielding discussing the relative merits of query parameter media-type indicators vs. file extension media-type indicators:</p>
<p>&ldquo;That's why I always prefer extensions. Neither choice has anything to do with REST.&rdquo; &mdash; Roy Fielding, <a href="http://tech.groups.yahoo.com/group/rest-discuss/message/14844">REST discuss mailing list</a></p>
<p>&ldquo;That's why I always prefer extensions. Neither choice has anything to do with REST.&rdquo; &mdash; Roy Fielding, <a href="https://groups.yahoo.com/neo/groups/rest-discuss/conversations/topics/14844">REST discuss mailing list</a></p>
<p>The quote does not mention Accept headers, but it does make it clear that format suffixes should be considered an acceptable pattern.</p>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Generic views - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/generic-views/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/generic-views/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Generic views">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Metadata - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/metadata/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/metadata/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Metadata">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -505,7 +516,7 @@ def schema(self, request):
<hr />
<h1 id="custom-metadata-classes"><a class="toclink" href="#custom-metadata-classes">Custom metadata classes</a></h1>
<p>If you want to provide a custom metadata class you should override <code>BaseMetadata</code> and implement the <code>determine_metadata(self, request, view)</code> method.</p>
<p>Useful things that you might want to do could include returning schema information, using a format such as <a href="http://json-schema.org/">JSON schema</a>, or returning debug information to admin users.</p>
<p>Useful things that you might want to do could include returning schema information, using a format such as <a href="https://json-schema.org/">JSON schema</a>, or returning debug information to admin users.</p>
<h2 id="example"><a class="toclink" href="#example">Example</a></h2>
<p>The following class could be used to limit the information that is returned to <code>OPTIONS</code> requests.</p>
<pre><code>class MinimalMetadata(BaseMetadata):
@ -527,7 +538,7 @@ def schema(self, request):
<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 metadata implementations.</p>
<h2 id="drf-schema-adapter"><a class="toclink" href="#drf-schema-adapter">DRF-schema-adapter</a></h2>
<p><a href="https://github.com/drf-forms/drf-schema-adapter">drf-schema-adapter</a> is a set of tools that makes it easier to provide schema information to frontend frameworks and libraries. It provides a metadata mixin as well as 2 metadata classes and several adapters suitable to generate <a href="http://json-schema.org/">json-schema</a> as well as schema information readable by various libraries.</p>
<p><a href="https://github.com/drf-forms/drf-schema-adapter">drf-schema-adapter</a> is a set of tools that makes it easier to provide schema information to frontend frameworks and libraries. It provides a metadata mixin as well as 2 metadata classes and several adapters suitable to generate <a href="https://json-schema.org/">json-schema</a> as well as schema information readable by various libraries.</p>
<p>You can also write your own adapter to work with your specific frontend.
If you wish to do so, it also provides an exporter that can export those schema information to json files.</p>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Pagination - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/pagination/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/pagination/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Pagination">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -518,7 +529,7 @@ class StandardResultsSetPagination(PageNumberPagination):
page_size_query_param = 'page_size'
max_page_size = 1000
</code></pre>
<p>You can then apply your new style to a view using the <code>.pagination_class</code> attribute:</p>
<p>You can then apply your new style to a view using the <code>pagination_class</code> attribute:</p>
<pre><code>class BillingRecordsView(generics.ListAPIView):
queryset = Billing.objects.all()
serializer_class = BillingRecordsSerializer
@ -627,7 +638,7 @@ class StandardResultsSetPagination(PageNumberPagination):
<li>The field should have a database index.</li>
</ul>
<p>Using an ordering field that does not satisfy these constraints will generally still work, but you'll be losing some of the benefits of cursor pagination.</p>
<p>For more technical details on the implementation we use for cursor pagination, the <a href="http://cramer.io/2011/03/08/building-cursors-for-the-disqus-api">"Building cursors for the Disqus API"</a> blog post gives a good overview of the basic approach.</p>
<p>For more technical details on the implementation we use for cursor pagination, the <a href="https://cra.mr/2011/03/08/building-cursors-for-the-disqus-api">"Building cursors for the Disqus API"</a> blog post gives a good overview of the basic approach.</p>
<h4 id="setup_2"><a class="toclink" href="#setup_2">Setup</a></h4>
<p>To enable the <code>CursorPagination</code> style globally, use the following configuration, modifying the <code>PAGE_SIZE</code> as desired:</p>
<pre><code>REST_FRAMEWORK = {

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Parsers - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/parsers/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/parsers/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Parsers">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Permissions - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/permissions/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/permissions/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Permissions">
<meta name="author" content="Tom Christie">
@ -58,7 +58,7 @@
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../throttling/">
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../caching/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../authentication/">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="./">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -575,6 +586,25 @@ def example_view(request, format=None):
return Response(content)
</code></pre>
<p><strong>Note:</strong> when you set new permission classes through class attribute or decorators you're telling the view to ignore the default list set over the <strong>settings.py</strong> file.</p>
<p>Provided they inherit from <code>rest_framework.permissions.BasePermission</code>, permissions can be composed using standard Python bitwise operators. For example, <code>IsAuthenticatedOrReadOnly</code> could be written:</p>
<pre><code>from rest_framework.permissions import BasePermission, IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
class ReadOnly(BasePermission):
def has_permission(self, request, view):
return request.method in SAFE_METHODS
class ExampleView(APIView):
permission_classes = (IsAuthenticated|ReadOnly)
def get(self, request, format=None):
content = {
'status': 'request was permitted'
}
return Response(content)
</code></pre>
<p><strong>Note:</strong> it only supports &amp; -and- and | -or-.</p>
<hr />
<h1 id="api-reference"><a class="toclink" href="#api-reference">API Reference</a></h1>
<h2 id="allowany"><a class="toclink" href="#allowany">AllowAny</a></h2>
@ -615,8 +645,7 @@ def example_view(request, format=None):
<p>Note that <code>DjangoObjectPermissions</code> <strong>does not</strong> require the <code>django-guardian</code> package, and should support other object-level backends equally well.</p>
<p>As with <code>DjangoModelPermissions</code> you can use custom model permissions by overriding <code>DjangoObjectPermissions</code> and setting the <code>.perms_map</code> property. Refer to the source code for details.</p>
<hr />
<p><strong>Note</strong>: If you need object level <code>view</code> permissions for <code>GET</code>, <code>HEAD</code> and <code>OPTIONS</code> requests, you'll want to consider also adding the <code>DjangoObjectPermissionsFilter</code> class to ensure that list endpoints only return results including objects for which the user has appropriate view permissions.</p>
<hr />
<p><strong>Note</strong>: If you need object level <code>view</code> permissions for <code>GET</code>, <code>HEAD</code> and <code>OPTIONS</code> requests and are using django-guardian for your object-level permissions backend, you'll want to consider using the <code>DjangoObjectPermissionsFilter</code> class provided by the <a href="https://github.com/rpkilby/django-rest-framework-guardian"><code>djangorestframework-guardian</code> package</a>. It ensures that list endpoints only return results including objects for which the user has appropriate view permissions.</p>
<hr />
<h1 id="custom-permissions"><a class="toclink" href="#custom-permissions">Custom permissions</a></h1>
<p>To implement a custom permission, override <code>BasePermission</code> and implement either, or both, of the following methods:</p>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Serializer relations - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/relations/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/relations/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Serializer relations">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -650,7 +661,7 @@ class Track(models.Model):
<hr />
<p><strong>Arguments</strong>:</p>
<ul>
<li><code>view_name</code> - The view name that should be used as the target of the relationship. If you're using <a href="http://www.django-rest-framework.org/api-guide/routers#defaultrouter">the standard router classes</a> this will be a string with the format <code>&lt;modelname&gt;-detail</code>. <strong>required</strong>.</li>
<li><code>view_name</code> - The view name that should be used as the target of the relationship. If you're using <a href="https://www.django-rest-framework.org/api-guide/routers#defaultrouter">the standard router classes</a> this will be a string with the format <code>&lt;modelname&gt;-detail</code>. <strong>required</strong>.</li>
<li><code>queryset</code> - The queryset used for model instance lookups when validating the field input. Relationships must either set a queryset explicitly, or set <code>read_only=True</code>.</li>
<li><code>many</code> - If applied to a to-many relationship, you should set this argument to <code>True</code>.</li>
<li><code>allow_null</code> - If set to <code>True</code>, the field will accept values of <code>None</code> or the empty string for nullable relationships. Defaults to <code>False</code>.</li>
@ -712,7 +723,7 @@ class Track(models.Model):
<p>This field is always read-only.</p>
<p><strong>Arguments</strong>:</p>
<ul>
<li><code>view_name</code> - The view name that should be used as the target of the relationship. If you're using <a href="http://www.django-rest-framework.org/api-guide/routers#defaultrouter">the standard router classes</a> this will be a string with the format <code>&lt;model_name&gt;-detail</code>. <strong>required</strong>.</li>
<li><code>view_name</code> - The view name that should be used as the target of the relationship. If you're using <a href="https://www.django-rest-framework.org/api-guide/routers#defaultrouter">the standard router classes</a> this will be a string with the format <code>&lt;model_name&gt;-detail</code>. <strong>required</strong>.</li>
<li><code>lookup_field</code> - The field on the target that should be used for the lookup. Should correspond to a URL keyword argument on the referenced view. Default is <code>'pk'</code>.</li>
<li><code>lookup_url_kwarg</code> - The name of the keyword argument defined in the URL conf that corresponds to the lookup field. Defaults to using the same value as <code>lookup_field</code>.</li>
<li><code>format</code> - If using format suffixes, hyperlinked fields will use the same format suffix for the target unless overridden by using the <code>format</code> argument.</li>
@ -836,7 +847,7 @@ class AlbumSerializer(serializers.ModelSerializer):
<p>The <code>get_url</code> method is used to map the object instance to its URL representation.</p>
<p>May raise a <code>NoReverseMatch</code> if the <code>view_name</code> and <code>lookup_field</code>
attributes are not configured to correctly match the URL conf.</p>
<p><strong>get_object(self, queryset, view_name, view_args, view_kwargs)</strong></p>
<p><strong>get_object(self, view_name, view_args, view_kwargs)</strong></p>
<p>If you want to support a writable hyperlinked field then you'll also want to override <code>get_object</code>, in order to map incoming URLs back to the object they represent. For read-only hyperlinked fields there is no need to override this method.</p>
<p>The return value of this method should the object that corresponds to the matched URL conf arguments.</p>
<p>May raise an <code>ObjectDoesNotExist</code> exception.</p>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Renderers - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/renderers/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/renderers/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Renderers">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -506,6 +517,10 @@
<a href="#messagepack">MessagePack</a>
</li>
<li>
<a href="#xlsx-binary-spreadsheet-endpoints">XLSX (Binary Spreadsheet Endpoints)</a>
</li>
<li>
<a href="#csv">CSV</a>
</li>
@ -799,7 +814,7 @@ In this case you can underspecify the media types it should respond to, by using
</code></pre>
<h2 id="designing-your-media-types"><a class="toclink" href="#designing-your-media-types">Designing your media types</a></h2>
<p>For the purposes of many Web APIs, simple <code>JSON</code> responses with hyperlinked relations may be sufficient. If you want to fully embrace RESTful design and <a href="http://timelessrepo.com/haters-gonna-hateoas">HATEOAS</a> you'll need to consider the design and usage of your media types in more detail.</p>
<p>In <a href="http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven">the words of Roy Fielding</a>, "A REST API should spend almost all of its descriptive effort in defining the media type(s) used for representing resources and driving application state, or in defining extended relation names and/or hypertext-enabled mark-up for existing standard media types.".</p>
<p>In <a href="https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven">the words of Roy Fielding</a>, "A REST API should spend almost all of its descriptive effort in defining the media type(s) used for representing resources and driving application state, or in defining extended relation names and/or hypertext-enabled mark-up for existing standard media types.".</p>
<p>For good examples of custom media types, see GitHub's use of a custom <a href="https://developer.github.com/v3/media/">application/vnd.github+json</a> media type, and Mike Amundsen's IANA approved <a href="http://www.amundsen.com/media-types/collection/">application/vnd.collection+json</a> JSON-based hypermedia.</p>
<h2 id="html-error-views"><a class="toclink" href="#html-error-views">HTML error views</a></h2>
<p>Typically a renderer will behave the same regardless of if it's dealing with a regular response, or with a response caused by an exception being raised, such as an <code>Http404</code> or <code>PermissionDenied</code> exception, or a subclass of <code>APIException</code>.</p>
@ -850,7 +865,7 @@ In this case you can underspecify the media types it should respond to, by using
<h2 id="jsonp"><a class="toclink" href="#jsonp">JSONP</a></h2>
<p><a href="https://jpadilla.github.io/django-rest-framework-jsonp/">REST framework JSONP</a> provides JSONP rendering support. It was previously included directly in the REST framework package, and is now instead supported as a third-party package.</p>
<hr />
<p><strong>Warning</strong>: If you require cross-domain AJAX requests, you should generally be using the more modern approach of <a href="https://www.w3.org/TR/cors/">CORS</a> as an alternative to <code>JSONP</code>. See the <a href="http://www.django-rest-framework.org/topics/ajax-csrf-cors/">CORS documentation</a> for more details.</p>
<p><strong>Warning</strong>: If you require cross-domain AJAX requests, you should generally be using the more modern approach of <a href="https://www.w3.org/TR/cors/">CORS</a> as an alternative to <code>JSONP</code>. See the <a href="https://www.django-rest-framework.org/topics/ajax-csrf-cors/">CORS documentation</a> for more details.</p>
<p>The <code>jsonp</code> approach is essentially a browser hack, and is <a href="https://stackoverflow.com/questions/613962/is-jsonp-safe-to-use">only appropriate for globally readable API endpoints</a>, where <code>GET</code> requests are unauthenticated and do not require any user permissions.</p>
<hr />
<h4 id="installation-configuration_2"><a class="toclink" href="#installation-configuration_2">Installation &amp; configuration</a></h4>
@ -866,6 +881,37 @@ In this case you can underspecify the media types it should respond to, by using
</code></pre>
<h2 id="messagepack"><a class="toclink" href="#messagepack">MessagePack</a></h2>
<p><a href="https://msgpack.org/">MessagePack</a> is a fast, efficient binary serialization format. <a href="https://github.com/juanriaza">Juan Riaza</a> maintains the <a href="https://github.com/juanriaza/django-rest-framework-msgpack">djangorestframework-msgpack</a> package which provides MessagePack renderer and parser support for REST framework.</p>
<h2 id="xlsx-binary-spreadsheet-endpoints"><a class="toclink" href="#xlsx-binary-spreadsheet-endpoints">XLSX (Binary Spreadsheet Endpoints)</a></h2>
<p>XLSX is the world's most popular binary spreadsheet format. <a href="https://githuc.com/flipperpa">Tim Allen</a> of <a href="https://github.com/wharton">The Wharton School</a> maintains <a href="https://github.com/wharton/drf-renderer-xlsx">drf-renderer-xlsx</a>, which renders an endpoint as an XLSX spreadsheet using OpenPyXL, and allows the client to download it. Spreadsheets can be styled on a per-view basis.</p>
<h4 id="installation-configuration_3"><a class="toclink" href="#installation-configuration_3">Installation &amp; configuration</a></h4>
<p>Install using pip.</p>
<pre><code>$ pip install drf-renderer-xlsx
</code></pre>
<p>Modify your REST framework settings.</p>
<pre><code>REST_FRAMEWORK = {
...
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
'rest_framework.renderers.BrowsableAPIRenderer',
'drf_renderer_xlsx.renderers.XLSXRenderer',
),
}
</code></pre>
<p>To avoid having a file streamed without a filename (which the browser will often default to the filename "download", with no extension), we need to use a mixin to override the <code>Content-Disposition</code> header. If no filename is provided, it will default to <code>export.xlsx</code>. For example:</p>
<pre><code>from rest_framework.viewsets import ReadOnlyModelViewSet
from drf_renderer_xlsx.mixins import XLSXFileMixin
from drf_renderer_xlsx.renderers import XLSXRenderer
from .models import MyExampleModel
from .serializers import MyExampleSerializer
class MyExampleViewSet(XLSXFileMixin, ReadOnlyModelViewSet):
queryset = MyExampleModel.objects.all()
serializer_class = MyExampleSerializer
renderer_classes = (XLSXRenderer,)
filename = 'my_export.xlsx'
</code></pre>
<h2 id="csv"><a class="toclink" href="#csv">CSV</a></h2>
<p>Comma-separated values are a plain-text tabular data format, that can be easily imported into spreadsheet applications. <a href="https://github.com/mjumbewu">Mjumbe Poe</a> maintains the <a href="https://github.com/mjumbewu/django-rest-framework-csv">djangorestframework-csv</a> package which provides CSV renderer support for REST framework.</p>
<h2 id="ultrajson"><a class="toclink" href="#ultrajson">UltraJSON</a></h2>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Requests - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/requests/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/requests/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Requests">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -538,7 +549,7 @@
<p>The <code>APIView</code> class or <code>@api_view</code> decorator will ensure that this property is automatically set to a list of <code>Authentication</code> instances, based on the <code>authentication_classes</code> set on the view or based on the <code>DEFAULT_AUTHENTICATORS</code> setting.</p>
<p>You won't typically need to access this property.</p>
<hr />
<p><strong>Note:</strong> You may see a <code>WrappedAttributeError</code> raised when calling the <code>.user</code> or <code>.auth</code> properties. These errors originate from an authenticator as a standard <code>AttributeError</code>, however it's necessary that they be re-raised as a different exception type in order to prevent them from being suppressed by the outer property access. Python will not recognize that the <code>AttributeError</code> orginates from the authenticator and will instaed assume that the request object does not have a <code>.user</code> or <code>.auth</code> property. The authenticator will need to be fixed.</p>
<p><strong>Note:</strong> You may see a <code>WrappedAttributeError</code> raised when calling the <code>.user</code> or <code>.auth</code> properties. These errors originate from an authenticator as a standard <code>AttributeError</code>, however it's necessary that they be re-raised as a different exception type in order to prevent them from being suppressed by the outer property access. Python will not recognize that the <code>AttributeError</code> orginates from the authenticator and will instead assume that the request object does not have a <code>.user</code> or <code>.auth</code> property. The authenticator will need to be fixed.</p>
<hr />
<h1 id="browser-enhancements"><a class="toclink" href="#browser-enhancements">Browser enhancements</a></h1>
<p>REST framework supports a few browser enhancements such as browser-based <code>PUT</code>, <code>PATCH</code> and <code>DELETE</code> forms.</p>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Responses - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/responses/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/responses/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Responses">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Returning URLs - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/reverse/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/reverse/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Returning URLs">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Routers - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/routers/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/routers/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Routers">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -468,7 +479,7 @@
<h1 id="routers"><a class="toclink" href="#routers">Routers</a></h1>
<blockquote>
<p>Resource routing allows you to quickly declare all of the common routes for a given resourceful controller. Instead of declaring separate routes for your index... a resourceful route declares them in a single line of code.</p>
<p>&mdash; <a href="http://guides.rubyonrails.org/routing.html">Ruby on Rails Documentation</a></p>
<p>&mdash; <a href="https://guides.rubyonrails.org/routing.html">Ruby on Rails Documentation</a></p>
</blockquote>
<p>Some Web frameworks such as Rails provide functionality for automatically determining how the URLs for an application should be mapped to the logic that deals with handling incoming requests.</p>
<p>REST framework adds support for automatic URL routing to Django, and provides you with a simple, quick and consistent way of wiring your view logic to a set of URLs.</p>
@ -488,7 +499,7 @@ urlpatterns = router.urls
</ul>
<p>Optionally, you may also specify an additional argument:</p>
<ul>
<li><code>base_name</code> - The base to use for the URL names that are created. If unset the basename will be automatically generated based on the <code>queryset</code> attribute of the viewset, if it has one. Note that if the viewset does not include a <code>queryset</code> attribute then you must set <code>base_name</code> when registering the viewset.</li>
<li><code>basename</code> - The base to use for the URL names that are created. If unset the basename will be automatically generated based on the <code>queryset</code> attribute of the viewset, if it has one. Note that if the viewset does not include a <code>queryset</code> attribute then you must set <code>basename</code> when registering the viewset.</li>
</ul>
<p>The example above would generate the following URL patterns:</p>
<ul>
@ -498,15 +509,15 @@ urlpatterns = router.urls
<li>URL pattern: <code>^accounts/{pk}/$</code> Name: <code>'account-detail'</code></li>
</ul>
<hr />
<p><strong>Note</strong>: The <code>base_name</code> argument is used to specify the initial part of the view name pattern. In the example above, that's the <code>user</code> or <code>account</code> part.</p>
<p>Typically you won't <em>need</em> to specify the <code>base_name</code> argument, but if you have a viewset where you've defined a custom <code>get_queryset</code> method, then the viewset may not have a <code>.queryset</code> attribute set. If you try to register that viewset you'll see an error like this:</p>
<pre><code>'base_name' argument not specified, and could not automatically determine the name from the viewset, as it does not have a '.queryset' attribute.
<p><strong>Note</strong>: The <code>basename</code> argument is used to specify the initial part of the view name pattern. In the example above, that's the <code>user</code> or <code>account</code> part.</p>
<p>Typically you won't <em>need</em> to specify the <code>basename</code> argument, but if you have a viewset where you've defined a custom <code>get_queryset</code> method, then the viewset may not have a <code>.queryset</code> attribute set. If you try to register that viewset you'll see an error like this:</p>
<pre><code>'basename' argument not specified, and could not automatically determine the name from the viewset, as it does not have a '.queryset' attribute.
</code></pre>
<p>This means you'll need to explicitly set the <code>base_name</code> argument when registering the viewset, as it could not be automatically determined from the model name.</p>
<p>This means you'll need to explicitly set the <code>basename</code> argument when registering the viewset, as it could not be automatically determined from the model name.</p>
<hr />
<h3 id="using-include-with-routers"><a class="toclink" href="#using-include-with-routers">Using <code>include</code> with routers</a></h3>
<p>The <code>.urls</code> attribute on a router instance is simply a standard list of URL patterns. There are a number of different styles for how you can include these URLs.</p>
<p>For example, you can append <code>router.urls</code> to a list of existing views</p>
<p>For example, you can append <code>router.urls</code> to a list of existing views...</p>
<pre><code>router = routers.SimpleRouter()
router.register(r'users', UserViewSet)
router.register(r'accounts', AccountViewSet)
@ -517,7 +528,7 @@ urlpatterns = [
urlpatterns += router.urls
</code></pre>
<p>Alternatively you can use Django's <code>include</code> function, like so</p>
<p>Alternatively you can use Django's <code>include</code> function, like so...</p>
<pre><code>urlpatterns = [
url(r'^forgot-password/$', ForgotPasswordFormView.as_view()),
url(r'^', include(router.urls)),
@ -708,13 +719,13 @@ urlpatterns = router.urls
<tr><th>URL</th><th>HTTP Method</th><th>Action</th><th>URL Name</th></tr>
<tr><td>/users</td><td>GET</td><td>list</td><td>user-list</td></tr>
<tr><td>/users/{username}</td><td>GET</td><td>retrieve</td><td>user-detail</td></tr>
<tr><td>/users/{username}/group-names</td><td>GET</td><td>group_names</td><td>user-group-names</td></tr>
<tr><td>/users/{username}/group_names</td><td>GET</td><td>group_names</td><td>user-group-names</td></tr>
</table>
<p>For another example of setting the <code>.routes</code> attribute, see the source code for the <code>SimpleRouter</code> class.</p>
<h2 id="advanced-custom-routers"><a class="toclink" href="#advanced-custom-routers">Advanced custom routers</a></h2>
<p>If you want to provide totally custom behavior, you can override <code>BaseRouter</code> and override the <code>get_urls(self)</code> method. The method should inspect the registered viewsets and return a list of URL patterns. The registered prefix, viewset and basename tuples may be inspected by accessing the <code>self.registry</code> attribute.</p>
<p>You may also want to override the <code>get_default_base_name(self, viewset)</code> method, or else always explicitly set the <code>base_name</code> argument when registering your viewsets with the router.</p>
<p>You may also want to override the <code>get_default_basename(self, viewset)</code> method, or else always explicitly set the <code>basename</code> argument when registering your viewsets with the router.</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>
<h2 id="drf-nested-routers"><a class="toclink" href="#drf-nested-routers">DRF Nested Routers</a></h2>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Schemas - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/schemas/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/schemas/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Schemas">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -391,7 +402,11 @@
<li>
<a href="#install-core-api">Install Core API</a>
<a href="#install-core-api-pyyaml">Install Core API &amp; PyYAML</a>
</li>
<li>
<a href="#quickstart">Quickstart</a>
</li>
<li>
@ -442,10 +457,6 @@
<a href="#explicit-schema-definition">Explicit schema definition</a>
</li>
<li>
<a href="#static-schema-file">Static schema file</a>
</li>
<li class="main">
<a href="#schemas-as-documentation">Schemas as documentation</a>
@ -521,13 +532,40 @@
<p>API schemas are a useful tool that allow for a range of use cases, including
generating reference documentation, or driving dynamic client libraries that
can interact with your API.</p>
<h2 id="install-core-api"><a class="toclink" href="#install-core-api">Install Core API</a></h2>
<h2 id="install-core-api-pyyaml"><a class="toclink" href="#install-core-api-pyyaml">Install Core API &amp; PyYAML</a></h2>
<p>You'll need to install the <code>coreapi</code> package in order to add schema support
for REST framework.</p>
<pre><code>pip install coreapi
for REST framework. You probably also want to install <code>pyyaml</code>, so that you
can render the schema into the commonly used YAML-based OpenAPI format.</p>
<pre><code>pip install coreapi pyyaml
</code></pre>
<h2 id="quickstart"><a class="toclink" href="#quickstart">Quickstart</a></h2>
<p>There are two different ways you can serve a schema description for you API.</p>
<h3 id="generating-a-schema-with-the-generateschema-management-command"><a class="toclink" href="#generating-a-schema-with-the-generateschema-management-command">Generating a schema with the <code>generateschema</code> management command</a></h3>
<p>To generate a static API schema, use the <code>generateschema</code> management command.</p>
<pre><code class="shell">$ python manage.py generateschema &gt; schema.yml
</code></pre>
<p>Once you've generated a schema in this way you can annotate it with any
additional information that cannot be automatically inferred by the schema
generator.</p>
<p>You might want to check your API schema into version control and update it
with each new release, or serve the API schema from your site's static media.</p>
<h3 id="adding-a-view-with-get_schema_view"><a class="toclink" href="#adding-a-view-with-get_schema_view">Adding a view with <code>get_schema_view</code></a></h3>
<p>To add a dynamically generated schema view to your API, use <code>get_schema_view</code>.</p>
<pre><code class="python">from rest_framework.schemas import get_schema_view
schema_view = get_schema_view(title=&quot;Example API&quot;)
urlpatterns = [
url('^schema$', schema_view),
...
]
</code></pre>
<p>See below <a href="#the-get_schema_view-shortcut">for more details</a> on customizing a
dynamically generated schema view.</p>
<h2 id="internal-schema-representation"><a class="toclink" href="#internal-schema-representation">Internal schema representation</a></h2>
<p>REST framework uses <a href="http://www.coreapi.org/">Core API</a> in order to model schema information in
<p>REST framework uses <a href="https://www.coreapi.org/">Core API</a> in order to model schema information in
a format-independent representation. This information can then be rendered
into various different schema formats, or used to generate API documentation.</p>
<p>When using Core API, a schema is represented as a <code>Document</code> which is the
@ -574,30 +612,17 @@ endpoint:</p>
<h2 id="schema-output-formats"><a class="toclink" href="#schema-output-formats">Schema output formats</a></h2>
<p>In order to be presented in an HTTP response, the internal representation
has to be rendered into the actual bytes that are used in the response.</p>
<p><a href="http://www.coreapi.org/specification/encoding/#core-json-encoding">Core JSON</a> is designed as a canonical format for use with Core API.
<p>REST framework includes a few different renderers that you can use for
encoding the API schema.</p>
<ul>
<li><code>renderers.OpenAPIRenderer</code> - Renders into YAML-based [OpenAPI][openapi], the most widely used API schema format.</li>
<li><code>renderers.JSONOpenAPIRenderer</code> - Renders into JSON-based [OpenAPI][openapi].</li>
<li><code>renderers.CoreJSONRenderer</code> - Renders into <a href="https://www.coreapi.org/specification/encoding/#core-json-encoding">Core JSON</a>, a format designed for
use with the <code>coreapi</code> client library.</li>
</ul>
<p><a href="https://www.coreapi.org/specification/encoding/#core-json-encoding">Core JSON</a> is designed as a canonical format for use with Core API.
REST framework includes a renderer class for handling this media type, which
is available as <code>renderers.CoreJSONRenderer</code>.</p>
<h3 id="alternate-schema-formats"><a class="toclink" href="#alternate-schema-formats">Alternate schema formats</a></h3>
<p>Other schema formats such as <a href="https://openapis.org/">Open API</a> ("Swagger"),
<a href="http://json-schema.org/latest/json-schema-hypermedia.html">JSON HyperSchema</a>, or <a href="https://apiblueprint.org/">API Blueprint</a> can also
be supported by implementing a custom renderer class that handles converting a
<code>Document</code> instance into a bytestring representation.</p>
<p>If there is a Core API codec package that supports encoding into the format you
want to use then implementing the renderer class can be done by using the codec.</p>
<h4 id="example"><a class="toclink" href="#example">Example</a></h4>
<p>For example, the <code>openapi_codec</code> package provides support for encoding or decoding
to the Open API ("Swagger") format:</p>
<pre><code>from rest_framework import renderers
from openapi_codec import OpenAPICodec
class SwaggerRenderer(renderers.BaseRenderer):
media_type = 'application/openapi+json'
format = 'swagger'
def render(self, data, media_type=None, renderer_context=None):
codec = OpenAPICodec()
return codec.dump(data)
</code></pre>
<h2 id="schemas-vs-hypermedia"><a class="toclink" href="#schemas-vs-hypermedia">Schemas vs Hypermedia</a></h2>
<p>It's worth pointing out here that Core API can also be used to model hypermedia
responses, which present an alternative interaction style to API schemas.</p>
@ -626,7 +651,7 @@ example above.</p>
</code></pre>
<h2 id="automatic-schema-generation"><a class="toclink" href="#automatic-schema-generation">Automatic Schema Generation</a></h2>
<p>Automatic schema generation is provided by the <code>SchemaGenerator</code> class.</p>
<p><code>SchemaGenerator</code> processes a list of routed URL pattterns and compiles the
<p><code>SchemaGenerator</code> processes a list of routed URL patterns and compiles the
appropriately structured Core API Document.</p>
<p>Basic usage is just to provide the title for your schema and call
<code>get_schema()</code>:</p>
@ -715,6 +740,13 @@ automatic generation elsewhere.</p>
...
schema = None # Will not appear in schema
</code></pre>
<p>This also applies to extra actions for <code>ViewSet</code>s:</p>
<pre><code> class CustomViewSet(viewsets.ModelViewSet):
@action(detail=True, schema=None)
def extra_action(self, request, pk=None):
...
</code></pre>
<hr />
<p><strong>Note</strong>: For full details on <code>SchemaGenerator</code> plus the <code>AutoSchema</code> and
<code>ManualSchema</code> descriptors see the <a href="#api-reference">API Reference below</a>.</p>
@ -772,13 +804,12 @@ ROOT_URLCONF setting.</p>
<h4 id="renderer_classes"><a class="toclink" href="#renderer_classes"><code>renderer_classes</code></a></h4>
<p>May be used to pass the set of renderer classes that can be used to render the API root endpoint.</p>
<pre><code>from rest_framework.schemas import get_schema_view
from rest_framework.renderers import CoreJSONRenderer
from my_custom_package import APIBlueprintRenderer
from rest_framework.renderers import JSONOpenAPIRenderer
schema_view = get_schema_view(
title='Server Monitoring API',
url='https://www.example.org/api/',
renderer_classes=[CoreJSONRenderer, APIBlueprintRenderer]
renderer_classes=[JSONOpenAPIRenderer]
)
</code></pre>
<h4 id="patterns"><a class="toclink" href="#patterns"><code>patterns</code></a></h4>
@ -819,7 +850,7 @@ from rest_framework import renderers, response, schemas
generator = schemas.SchemaGenerator(title='Bookings API')
@api_view()
@renderer_classes([renderers.CoreJSONRenderer])
@renderer_classes([renderers.OpenAPIRenderer])
def schema_view(request):
schema = generator.get_schema(request)
return response.Response(schema)
@ -838,7 +869,7 @@ made visible to different users depending on their role.</p>
<p>In order to present a schema with endpoints filtered by user permissions,
you need to pass the <code>request</code> argument to the <code>get_schema()</code> method, like so:</p>
<pre><code>@api_view()
@renderer_classes([renderers.CoreJSONRenderer])
@renderer_classes([renderers.OpenAPIRenderer])
def schema_view(request):
generator = schemas.SchemaGenerator(title='Bookings API')
return response.Response(generator.get_schema(request=request))
@ -860,19 +891,10 @@ schema = coreapi.Document(
)
@api_view()
@renderer_classes([renderers.CoreJSONRenderer])
@renderer_classes([renderers.OpenAPIRenderer])
def schema_view(request):
return response.Response(schema)
</code></pre>
<h2 id="static-schema-file"><a class="toclink" href="#static-schema-file">Static schema file</a></h2>
<p>A final option is to write your API schema as a static file, using one
of the available formats, such as Core JSON or Open API.</p>
<p>You could then either:</p>
<ul>
<li>Write a schema definition as a static file, and <a href="https://docs.djangoproject.com/en/stable/howto/static-files/">serve the static file directly</a>.</li>
<li>Write a schema definition that is loaded using <code>Core API</code>, and then
rendered to one of many available formats, depending on the client request.</li>
</ul>
<hr />
<h1 id="schemas-as-documentation"><a class="toclink" href="#schemas-as-documentation">Schemas as documentation</a></h1>
<p>One common usage of API schemas is to use them to build documentation pages.</p>
@ -945,7 +967,7 @@ and collates the resulting CoreAPI Document.</p>
<h3 id="get_schemaself-request"><a class="toclink" href="#get_schemaself-request">get_schema(self, request)</a></h3>
<p>Returns a <code>coreapi.Document</code> instance that represents the API schema.</p>
<pre><code>@api_view
@renderer_classes([renderers.CoreJSONRenderer])
@renderer_classes([renderers.OpenAPIRenderer])
def schema_view(request):
generator = schemas.SchemaGenerator(title='Bookings API')
return Response(generator.get_schema())
@ -999,13 +1021,13 @@ view docstring as described in the "Schemas as Documentation" section above.</p>
with the given view. Eg. <code>'application/json'</code>. May return a blank string for views
that do not expect a request body.</p>
<h3 id="get_path_fieldsself-path-method"><a class="toclink" href="#get_path_fieldsself-path-method">get_path_fields(self, path, method):</a></h3>
<p>Return a list of <code>coreapi.Link()</code> instances. One for each path parameter in the URL.</p>
<p>Return a list of <code>coreapi.Field()</code> instances. One for each path parameter in the URL.</p>
<h3 id="get_serializer_fieldsself-path-method"><a class="toclink" href="#get_serializer_fieldsself-path-method">get_serializer_fields(self, path, method)</a></h3>
<p>Return a list of <code>coreapi.Link()</code> instances. One for each field in the serializer class used by the view.</p>
<p>Return a list of <code>coreapi.Field()</code> instances. One for each field in the serializer class used by the view.</p>
<h3 id="get_pagination_fieldsself-path-method"><a class="toclink" href="#get_pagination_fieldsself-path-method">get_pagination_fields(self, path, method)</a></h3>
<p>Return a list of <code>coreapi.Link()</code> instances, as returned by the <code>get_schema_fields()</code> method on any pagination class used by the view.</p>
<p>Return a list of <code>coreapi.Field()</code> instances, as returned by the <code>get_schema_fields()</code> method on any pagination class used by the view.</p>
<h3 id="get_filter_fieldsself-path-method"><a class="toclink" href="#get_filter_fieldsself-path-method">get_filter_fields(self, path, method)</a></h3>
<p>Return a list of <code>coreapi.Link()</code> instances, as returned by the <code>get_schema_fields()</code> method of any filter classes used by the view.</p>
<p>Return a list of <code>coreapi.Field()</code> instances, as returned by the <code>get_schema_fields()</code> method of any filter classes used by the view.</p>
<h3 id="get_manual_fieldsself-path-method"><a class="toclink" href="#get_manual_fieldsself-path-method">get_manual_fields(self, path, method)</a></h3>
<p>Return a list of <code>coreapi.Field()</code> instances to be added to or replace generated fields. Defaults to (optional) <code>manual_fields</code> passed to <code>AutoSchema</code> constructor.</p>
<p>May be overridden to customise manual fields by <code>path</code> or <code>method</code>. For example, a per-method adjustment may look like this:</p>
@ -1130,7 +1152,7 @@ Valid only if a <code>location="body"</code> field is included on the <code>Link
<hr />
<h1 id="third-party-packages"><a class="toclink" href="#third-party-packages">Third party packages</a></h1>
<h2 id="drf-yasg-yet-another-swagger-generator"><a class="toclink" href="#drf-yasg-yet-another-swagger-generator">drf-yasg - Yet Another Swagger Generator</a></h2>
<p><a href="https://github.com/axnsan12/drf-yasg/">drf-yasg</a> generates <a href="https://openapis.org/">OpenAPI</a> documents suitable for code generation - nested schemas,
<p><a href="https://github.com/axnsan12/drf-yasg/">drf-yasg</a> generates <a href="https://openapis.org/">OpenAPI</a> documents suitable for code generation - nested schemas,
named models, response bodies, enum/pattern/min/max validators, form parameters, etc.</p>
<h2 id="drf-openapi"><a class="toclink" href="#drf-openapi">DRF OpenAPI</a></h2>
<p><a href="https://github.com/limdauto/drf_openapi">DRF OpenAPI</a> renders the schema generated by Django Rest Framework

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Serializers - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/serializers/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/serializers/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Serializers">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -668,10 +679,10 @@ json
</code></pre>
<h2 id="deserializing-objects"><a class="toclink" href="#deserializing-objects">Deserializing objects</a></h2>
<p>Deserialization is similar. First we parse a stream into Python native datatypes...</p>
<pre><code>from django.utils.six import BytesIO
<pre><code>import io
from rest_framework.parsers import JSONParser
stream = BytesIO(json)
stream = io.BytesIO(json)
data = JSONParser().parse(stream)
</code></pre>
<p>...then we restore those native datatypes into a dictionary of validated data.</p>
@ -1413,7 +1424,7 @@ def all_high_scores(request):
<pre><code>class MyBaseSerializer(Serializer):
my_field = serializers.CharField()
def validate_my_field(self):
def validate_my_field(self, value):
...
class MySerializer(MyBaseSerializer):

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Settings - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/settings/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/settings/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Settings">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -699,23 +710,32 @@ internally in the codebase.</p>
<h4 id="view_name_function"><a class="toclink" href="#view_name_function">VIEW_NAME_FUNCTION</a></h4>
<p>A string representing the function that should be used when generating view names.</p>
<p>This should be a function with the following signature:</p>
<pre><code>view_name(cls, suffix=None)
<pre><code>view_name(self)
</code></pre>
<ul>
<li><code>cls</code>: The view class. Typically the name function would inspect the name of the class when generating a descriptive name, by accessing <code>cls.__name__</code>.</li>
<li><code>suffix</code>: The optional suffix used when differentiating individual views in a viewset.</li>
<li><code>self</code>: The view instance. Typically the name function would inspect the name of the class when generating a descriptive name, by accessing <code>self.__class__.__name__</code>.</li>
</ul>
<p>If the view instance inherits <code>ViewSet</code>, it may have been initialized with several optional arguments:</p>
<ul>
<li><code>name</code>: A name expliticly provided to a view in the viewset. Typically, this value should be used as-is when provided.</li>
<li><code>suffix</code>: Text used when differentiating individual views in a viewset. This argument is mutually exclusive to <code>name</code>.</li>
<li><code>detail</code>: Boolean that differentiates an individual view in a viewset as either being a 'list' or 'detail' view.</li>
</ul>
<p>Default: <code>'rest_framework.views.get_view_name'</code></p>
<h4 id="view_description_function"><a class="toclink" href="#view_description_function">VIEW_DESCRIPTION_FUNCTION</a></h4>
<p>A string representing the function that should be used when generating view descriptions.</p>
<p>This setting can be changed to support markup styles other than the default markdown. For example, you can use it to support <code>rst</code> markup in your view docstrings being output in the browsable API.</p>
<p>This should be a function with the following signature:</p>
<pre><code>view_description(cls, html=False)
<pre><code>view_description(self, html=False)
</code></pre>
<ul>
<li><code>cls</code>: The view class. Typically the description function would inspect the docstring of the class when generating a description, by accessing <code>cls.__doc__</code></li>
<li><code>self</code>: The view instance. Typically the description function would inspect the docstring of the class when generating a description, by accessing <code>self.__class__.__doc__</code></li>
<li><code>html</code>: A boolean indicating if HTML output is required. <code>True</code> when used in the browsable API, and <code>False</code> when used in generating <code>OPTIONS</code> responses.</li>
</ul>
<p>If the view instance inherits <code>ViewSet</code>, it may have been initialized with several optional arguments:</p>
<ul>
<li><code>description</code>: A description explicitly provided to the view in the viewset. Typically, this is set by extra viewset <code>action</code>s, and should be used as-is.</li>
</ul>
<p>Default: <code>'rest_framework.views.get_view_description'</code></p>
<h2 id="html-select-field-cutoffs"><a class="toclink" href="#html-select-field-cutoffs">HTML Select Field cutoffs</a></h2>
<p>Global settings for <a href="../relations/#select-field-cutoffs">select field cutoffs for rendering relational fields</a> in the browsable API.</p>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Status codes - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/status-codes/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/status-codes/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Status codes">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Testing - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/testing/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/testing/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Testing">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -672,7 +683,9 @@ live environment. (See "Live tests" below.)</li>
</ul>
<p>This exposes exactly the same interface as if you were using a requests session
directly.</p>
<pre><code>client = RequestsClient()
<pre><code>from rest_framework.test import RequestsClient
client = RequestsClient()
response = client.get('http://testserver/users/')
assert response.status_code == 200
</code></pre>
@ -698,12 +711,12 @@ token in the following request.</p>
<pre><code>client = RequestsClient()
# Obtain a CSRF token.
response = client.get('/homepage/')
response = client.get('http://testserver/homepage/')
assert response.status_code == 200
csrftoken = response.cookies['csrftoken']
# Interact with the API.
response = client.post('/organisations/', json={
response = client.post('http://testserver/organisations/', json={
'name': 'MegaCorp',
'status': 'active'
}, headers={'X-CSRFToken': csrftoken})

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Throttling - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/throttling/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/throttling/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Throttling">
<meta name="author" content="Tom Christie">
@ -61,7 +61,7 @@
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../filtering/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../permissions/">
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../caching/">
<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>
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li class="active" >
<a href="./">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Validators - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/validators/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/validators/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Validators">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -691,7 +702,7 @@ that the resulting behavior is more transparent.</p>
<h4 id="field-level-validation"><a class="toclink" href="#field-level-validation">Field-level validation</a></h4>
<p>You can specify custom field-level validation by adding <code>.validate_&lt;field_name&gt;</code> methods
to your <code>Serializer</code> subclass. This is documented in the
<a href="http://www.django-rest-framework.org/api-guide/serializers/#field-level-validation">Serializer docs</a></p>
<a href="https://www.django-rest-framework.org/api-guide/serializers/#field-level-validation">Serializer docs</a></p>
<h2 id="class-based"><a class="toclink" href="#class-based">Class-based</a></h2>
<p>To write a class-based validator, use the <code>__call__</code> method. Class-based validators are useful as they allow you to parameterize and reuse behavior.</p>
<pre><code>class MultipleOf(object):

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Versioning - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/versioning/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/versioning/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Versioning">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Views - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/views/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/views/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Views">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Viewsets - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/api-guide/viewsets/" />
<link rel="canonical" href="https://www.django-rest-framework.org/api-guide/viewsets/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Viewsets">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<a href="../permissions/">Permissions</a>
</li>
<li >
<a href="../caching/">Caching</a>
</li>
<li >
<a href="../throttling/">Throttling</a>
</li>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -466,7 +477,7 @@
<h1 id="viewsets"><a class="toclink" href="#viewsets">ViewSets</a></h1>
<blockquote>
<p>After routing has determined which controller to use for a request, your controller is responsible for making sense of the request and producing the appropriate output.</p>
<p>&mdash; <a href="http://guides.rubyonrails.org/routing.html">Ruby on Rails Documentation</a></p>
<p>&mdash; <a href="https://guides.rubyonrails.org/routing.html">Ruby on Rails Documentation</a></p>
</blockquote>
<p>Django REST framework allows you to combine the logic for a set of related views in a single class, called a <code>ViewSet</code>. In other frameworks you may also find conceptually similar implementations named something like 'Resources' or 'Controllers'.</p>
<p>A <code>ViewSet</code> class is simply <strong>a type of class-based View, that does not provide any method handlers</strong> such as <code>.get()</code> or <code>.post()</code>, and instead provides actions such as <code>.list()</code> and <code>.create()</code>.</p>
@ -504,7 +515,7 @@ user_detail = UserViewSet.as_view({'get': 'retrieve'})
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register(r'users', UserViewSet, base_name='user')
router.register(r'users', UserViewSet, basename='user')
urlpatterns = router.urls
</code></pre>
<p>Rather than writing your own viewsets, you'll often want to use the existing base classes that provide a default set of behavior. For example:</p>
@ -557,6 +568,8 @@ urlpatterns = router.urls
<li><code>action</code> - the name of the current action (e.g., <code>list</code>, <code>create</code>).</li>
<li><code>detail</code> - boolean indicating if the current action is configured for a list or detail view.</li>
<li><code>suffix</code> - the display suffix for the viewset type - mirrors the <code>detail</code> attribute.</li>
<li><code>name</code> - the display name for the viewset. This argument is mutually exclusive to <code>suffix</code>.</li>
<li><code>description</code> - the display description for the individual view of a viewset.</li>
</ul>
<p>You may inspect these attributes to adjust behaviour based on the current action. For example, you could restrict permissions to everything except the <code>list</code> action similar to this:</p>
<pre><code>def get_permissions(self):
@ -570,7 +583,7 @@ urlpatterns = router.urls
return [permission() for permission in permission_classes]
</code></pre>
<h2 id="marking-extra-actions-for-routing"><a class="toclink" href="#marking-extra-actions-for-routing">Marking extra actions for routing</a></h2>
<p>If you have ad-hoc methods that should be routable, you can mark them as such with the <code>@action</code> decorator. Like regular actions, extra actions may be intended for either a list of objects, or a single instance. To indicate this, set the <code>detail</code> argument to <code>True</code> or <code>False</code>. The router will configure its URL patterns accordingly. e.g., the <code>DefaultRouter</code> will configure detail actions to contain <code>pk</code> in their URL patterns.</p>
<p>If you have ad-hoc methods that should be routable, you can mark them as such with the <code>@action</code> decorator. Like regular actions, extra actions may be intended for either a single object, or an entire collection. To indicate this, set the <code>detail</code> argument to <code>True</code> or <code>False</code>. The router will configure its URL patterns accordingly. e.g., the <code>DefaultRouter</code> will configure detail actions to contain <code>pk</code> in their URL patterns.</p>
<p>A more complete example of extra actions:</p>
<pre><code>from django.contrib.auth.models import User
from rest_framework import status, viewsets
@ -585,7 +598,7 @@ class UserViewSet(viewsets.ModelViewSet):
queryset = User.objects.all()
serializer_class = UserSerializer
@action(methods=['post'], detail=True)
@action(detail=True, methods=['post'])
def set_password(self, request, pk=None):
user = self.get_object()
serializer = PasswordSerializer(data=request.data)
@ -599,7 +612,7 @@ class UserViewSet(viewsets.ModelViewSet):
@action(detail=False)
def recent_users(self, request):
recent_users = User.objects.all().order('-last_login')
recent_users = User.objects.all().order_by('-last_login')
page = self.paginate_queryset(recent_users)
if page is not None:
@ -610,17 +623,30 @@ class UserViewSet(viewsets.ModelViewSet):
return Response(serializer.data)
</code></pre>
<p>The decorator can additionally take extra arguments that will be set for the routed view only. For example:</p>
<pre><code> @action(methods=['post'], detail=True, permission_classes=[IsAdminOrIsSelf])
<pre><code> @action(detail=True, methods=['post'], permission_classes=[IsAdminOrIsSelf])
def set_password(self, request, pk=None):
...
</code></pre>
<p>These decorator will route <code>GET</code> requests by default, but may also accept other HTTP methods by setting the <code>methods</code> argument. For example:</p>
<pre><code> @action(methods=['post', 'delete'], detail=True)
<p>The <code>action</code> decorator will route <code>GET</code> requests by default, but may also accept other HTTP methods by setting the <code>methods</code> argument. For example:</p>
<pre><code> @action(detail=True, methods=['post', 'delete'])
def unset_password(self, request, pk=None):
...
</code></pre>
<p>The two new actions will then be available at the urls <code>^users/{pk}/set_password/$</code> and <code>^users/{pk}/unset_password/$</code></p>
<p>To view all extra actions, call the <code>.get_extra_actions()</code> method.</p>
<h3 id="routing-additional-http-methods-for-extra-actions"><a class="toclink" href="#routing-additional-http-methods-for-extra-actions">Routing additional HTTP methods for extra actions</a></h3>
<p>Extra actions can map additional HTTP methods to separate <code>ViewSet</code> methods. For example, the above password set/unset methods could be consolidated into a single route. Note that additional mappings do not accept arguments.</p>
<pre><code class="python"> @action(detail=True, methods=['put'], name='Change Password')
def password(self, request, pk=None):
&quot;&quot;&quot;Update the user's password.&quot;&quot;&quot;
...
@password.mapping.delete
def delete_password(self, request, pk=None):
&quot;&quot;&quot;Delete the user's password.&quot;&quot;&quot;
...
</code></pre>
<h2 id="reversing-action-urls"><a class="toclink" href="#reversing-action-urls">Reversing action URLs</a></h2>
<p>If you need to get the URL of an action, use the <code>.reverse_action()</code> method. This is a convenience wrapper for <code>reverse()</code>, automatically passing the view's <code>request</code> object and prepending the <code>url_name</code> with the <code>.basename</code> attribute.</p>
<p>Note that the <code>basename</code> is provided by the router during <code>ViewSet</code> registration. If you are not using a router, then you must provide the <code>basename</code> argument to the <code>.as_view()</code> method.</p>
@ -668,7 +694,7 @@ class UserViewSet(viewsets.ModelViewSet):
def get_queryset(self):
return self.request.user.accounts.all()
</code></pre>
<p>Note however that upon removal of the <code>queryset</code> property from your <code>ViewSet</code>, any associated <a href="../routers/">router</a> will be unable to derive the base_name of your Model automatically, and so you will have to specify the <code>base_name</code> kwarg as part of your <a href="../routers/">router registration</a>.</p>
<p>Note however that upon removal of the <code>queryset</code> property from your <code>ViewSet</code>, any associated <a href="../routers/">router</a> will be unable to derive the basename of your Model automatically, and so you will have to specify the <code>basename</code> kwarg as part of your <a href="../routers/">router registration</a>.</p>
<p>Also note that although this class provides the complete set of create/list/retrieve/update/destroy actions by default, you can restrict the available operations by using the standard permission classes.</p>
<h2 id="readonlymodelviewset"><a class="toclink" href="#readonlymodelviewset">ReadOnlyModelViewSet</a></h2>
<p>The <code>ReadOnlyModelViewSet</code> class also inherits from <code>GenericAPIView</code>. As with <code>ModelViewSet</code> it also includes implementations for various actions, but unlike <code>ModelViewSet</code> only provides the 'read-only' actions, <code>.list()</code> and <code>.retrieve()</code>.</p>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>3.0 Announcement - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/3.0-announcement/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/3.0-announcement/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 3.0 Announcement">
<meta name="author" content="Tom Christie">
@ -58,10 +58,10 @@
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.1-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../kickstarter-announcement/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../jobs/">
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.1-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>
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
@ -287,35 +298,11 @@
</li>
<li >
<a href="../jobs/">Jobs</a>
</li>
<li class="active" >
<a href="./">3.0 Announcement</a>
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li >
@ -323,7 +310,31 @@
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<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 class="active" >
<a href="./">3.0 Announcement</a>
</li>
<li >
@ -339,7 +350,7 @@
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../jobs/">Jobs</a>
</li>
</ul>
@ -450,7 +461,7 @@
<p><strong>This release is incremental in nature. There <em>are</em> some breaking API changes, and upgrading <em>will</em> require you to read the release notes carefully, but the migration path should otherwise be relatively straightforward.</strong></p>
<p>The difference in quality of the REST framework API and implementation should make writing, maintaining and debugging your application far easier.</p>
<p>3.0 is the first of three releases that have been funded by our recent <a href="https://www.kickstarter.com/projects/tomchristie/django-rest-framework-3">Kickstarter campaign</a>.</p>
<p>As ever, a huge thank you to our many <a href="http://www.django-rest-framework.org/topics/kickstarter-announcement/#sponsors">wonderful sponsors</a>. If you're looking for a Django gig, and want to work with smart community-minded folks, you should probably check out that list and see who's hiring.</p>
<p>As ever, a huge thank you to our many <a href="https://www.django-rest-framework.org/topics/kickstarter-announcement/#sponsors">wonderful sponsors</a>. If you're looking for a Django gig, and want to work with smart community-minded folks, you should probably check out that list and see who's hiring.</p>
<hr />
<h2 id="new-features"><a class="toclink" href="#new-features">New features</a></h2>
<p>Notable features of this new release include:</p>
@ -474,7 +485,7 @@
<hr />
<p><em>Below is an in-depth guide to the API changes and migration notes for 3.0.</em></p>
<h2 id="request-objects"><a class="toclink" href="#request-objects">Request objects</a></h2>
<h4 id="the-data-and-query_params-properties"><code>.query_params</code> properties.<a class="toclink" href="#the-data-and-query_params-properties">The <code>.data</code> and </a></h4>
<h4 id="the-data-and-query_params-properties"><a class="toclink" href="#the-data-and-query_params-properties">The <code>.data</code> and <code>.query_params</code> properties.</a></h4>
<p>The usage of <code>request.DATA</code> and <code>request.FILES</code> is now pending deprecation in favor of a single <code>request.data</code> attribute that contains <em>all</em> the parsed data.</p>
<p>Having separate attributes is reasonable for web applications that only ever parse url-encoded or multipart requests, but makes less sense for the general-purpose request parsing that REST framework supports.</p>
<p>You may now pass all the request data to a serializer class in a single argument:</p>
@ -506,7 +517,7 @@ ExampleSerializer(data=request.DATA, files=request.FILES)
<li>Calling <code>serializer.save()</code> then saves and returns the new object instance.</li>
</ol>
<p>The resulting API changes are further detailed below.</p>
<h4 id="the-create-and-update-methods"><code>.update()</code> methods.<a class="toclink" href="#the-create-and-update-methods">The <code>.create()</code> and </a></h4>
<h4 id="the-create-and-update-methods"><a class="toclink" href="#the-create-and-update-methods">The <code>.create()</code> and <code>.update()</code> methods.</a></h4>
<p>The <code>.restore_object()</code> method is now removed, and we instead have two separate methods, <code>.create()</code> and <code>.update()</code>. These methods work slightly different to the previous <code>.restore_object()</code>.</p>
<p>When using the <code>.create()</code> and <code>.update()</code> methods you should both create <em>and save</em> the object instance. This is in contrast to the previous <code>.restore_object()</code> behavior that would instantiate the object but not save it.</p>
<p>These methods also replace the optional <code>.save_object()</code> method, which no longer exists.</p>
@ -538,7 +549,7 @@ def create(self, validated_data):
return Snippet.objects.create(**validated_data)
</code></pre>
<p>Note that these methods should return the newly created object instance.</p>
<h4 id="use-validated_data-instead-of-object"><code>.object</code>.<a class="toclink" href="#use-validated_data-instead-of-object">Use <code>.validated_data</code> instead of </a></h4>
<h4 id="use-validated_data-instead-of-object"><a class="toclink" href="#use-validated_data-instead-of-object">Use <code>.validated_data</code> instead of <code>.object</code>.</a></h4>
<p>You must now use the <code>.validated_data</code> attribute if you need to inspect the data before saving, rather than using the <code>.object</code> attribute, which no longer exists.</p>
<p>For example the following code <em>is no longer valid</em>:</p>
<pre><code>if serializer.is_valid():
@ -886,7 +897,7 @@ def all_high_scores(request):
</code></pre>
<hr />
<h2 id="serializer-fields"><a class="toclink" href="#serializer-fields">Serializer fields</a></h2>
<h4 id="the-field-and-readonly-field-classes"><code>ReadOnly</code> field classes.<a class="toclink" href="#the-field-and-readonly-field-classes">The <code>Field</code> and </a></h4>
<h4 id="the-field-and-readonly-field-classes"><a class="toclink" href="#the-field-and-readonly-field-classes">The <code>Field</code> and <code>ReadOnly</code> field classes.</a></h4>
<p>There are some minor tweaks to the field base classes.</p>
<p>Previously we had these two base classes:</p>
<ul>
@ -898,7 +909,7 @@ def all_high_scores(request):
<li><code>Field</code> is the base class for all fields. It does not include any default implementation for either serializing or deserializing data.</li>
<li><code>ReadOnlyField</code> is a concrete implementation for read-only fields that simply returns the attribute value without modification.</li>
</ul>
<h4 id="the-required-allow_null-allow_blank-and-default-arguments"><code>allow_null</code>, <code>default</code> arguments.<a class="toclink" href="#the-required-allow_null-allow_blank-and-default-arguments">The <code>required</code>, <code>allow_blank</code> and </a></h4>
<h4 id="the-required-allow_null-allow_blank-and-default-arguments"><a class="toclink" href="#the-required-allow_null-allow_blank-and-default-arguments">The <code>required</code>, <code>allow_null</code>, <code>allow_blank</code> and <code>default</code> arguments.</a></h4>
<p>REST framework now has more explicit and clear control over validating empty values for fields.</p>
<p>Previously the meaning of the <code>required=False</code> keyword argument was underspecified. In practice its use meant that a field could either be not included in the input, or it could be included, but be <code>None</code> or the empty string.</p>
<p>We now have a better separation, with separate <code>required</code>, <code>allow_null</code> and <code>allow_blank</code> arguments.</p>
@ -1008,7 +1019,7 @@ This removes some magic and makes it easier and more obvious to move between imp
<p>The following usage will <em>now raise an error</em>:</p>
<pre><code>email = serializers.EmailField(source='email')
</code></pre>
<h4 id="the-uniquevalidator-and-uniquetogethervalidator-classes"><code>UniqueTogetherValidator</code> classes.<a class="toclink" href="#the-uniquevalidator-and-uniquetogethervalidator-classes">The <code>UniqueValidator</code> and </a></h4>
<h4 id="the-uniquevalidator-and-uniquetogethervalidator-classes"><a class="toclink" href="#the-uniquevalidator-and-uniquetogethervalidator-classes">The <code>UniqueValidator</code> and <code>UniqueTogetherValidator</code> classes.</a></h4>
<p>REST framework now provides new validators that allow you to ensure field uniqueness, while still using a completely explicit <code>Serializer</code> class instead of using <code>ModelSerializer</code>.</p>
<p>The <code>UniqueValidator</code> should be applied to a serializer field, and takes a single <code>queryset</code> argument.</p>
<pre><code>from rest_framework import serializers

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>3.1 Announcement - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/3.1-announcement/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/3.1-announcement/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 3.1 Announcement">
<meta name="author" content="Tom Christie">
@ -58,10 +58,10 @@
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.2-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.0-announcement/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.0-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.2-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>
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
@ -287,35 +298,11 @@
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li class="active" >
<a href="./">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li >
@ -323,7 +310,31 @@
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<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 class="active" >
<a href="./">3.1 Announcement</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li >
@ -339,7 +350,7 @@
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../jobs/">Jobs</a>
</li>
</ul>
@ -494,7 +505,7 @@
</code></pre>
<hr />
<h2 id="internationalization"><a class="toclink" href="#internationalization">Internationalization</a></h2>
<p>REST framework now includes a built-in set of translations, and <a href="../internationalization/">supports internationalized error responses</a>. This allows you to either change the default language, or to allow clients to specify the language via the <code>Accept-Language</code> header.</p>
<p>REST framework now includes a built-in set of translations, and <a href="../../topics/internationalization/">supports internationalized error responses</a>. This allows you to either change the default language, or to allow clients to specify the language via the <code>Accept-Language</code> header.</p>
<p>You can change the default language by using the standard Django <code>LANGUAGE_CODE</code> setting:</p>
<pre><code>LANGUAGE_CODE = "es-es"
</code></pre>
@ -527,7 +538,7 @@ Host: example.org
('en', _('English')),
]
</code></pre>
<p>For more details, see the <a href="../internationalization/">internationalization documentation</a>.</p>
<p>For more details, see the <a href="../../topics/internationalization/">internationalization documentation</a>.</p>
<p>Many thanks to <a href="https://github.com/jakul">Craig Blaszczyk</a> for helping push this through.</p>
<hr />
<h2 id="new-field-types"><a class="toclink" href="#new-field-types">New field types</a></h2>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>3.2 Announcement - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/3.2-announcement/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/3.2-announcement/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 3.2 Announcement">
<meta name="author" content="Tom Christie">
@ -58,10 +58,10 @@
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.3-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.1-announcement/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.1-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.3-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>
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
@ -287,35 +298,11 @@
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li class="active" >
<a href="./">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li >
@ -323,7 +310,31 @@
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<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 class="active" >
<a href="./">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 >
@ -339,7 +350,7 @@
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../jobs/">Jobs</a>
</li>
</ul>
@ -431,7 +442,7 @@
<p>This interface is intended to act as a more user-friendly interface to the API. It can be used either as a replacement to the existing <code>BrowsableAPIRenderer</code>, or used together with it, allowing you to switch between the two styles as required.</p>
<p>We've also fixed a huge number of issues, and made numerous cleanups and improvements.</p>
<p>Over the course of the 3.1.x series we've <a href="https://github.com/encode/django-rest-framework/issues?utf8=%E2%9C%93&amp;q=closed%3A%3E2015-03-05">resolved nearly 600 tickets</a> on our GitHub issue tracker. This means we're currently running at a rate of <strong>closing around 100 issues or pull requests per month</strong>.</p>
<p>None of this would have been possible without the support of our wonderful Kickstarter backers. If you're looking for a job in Django development we'd strongly recommend taking <a href="http://www.django-rest-framework.org/topics/kickstarter-announcement/#sponsors">a look through our sponsors</a> and finding out who's hiring.</p>
<p>None of this would have been possible without the support of our wonderful Kickstarter backers. If you're looking for a job in Django development we'd strongly recommend taking <a href="https://www.django-rest-framework.org/topics/kickstarter-announcement/#sponsors">a look through our sponsors</a> and finding out who's hiring.</p>
<h2 id="adminrenderer"><a class="toclink" href="#adminrenderer">AdminRenderer</a></h2>
<p>To include <code>AdminRenderer</code> simply add it to your settings:</p>
<pre><code>REST_FRAMEWORK = {

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>3.3 Announcement - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/3.3-announcement/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/3.3-announcement/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 3.3 Announcement">
<meta name="author" content="Tom Christie">
@ -58,10 +58,10 @@
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.4-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.2-announcement/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.2-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.4-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>
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
@ -287,35 +298,11 @@
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li class="active" >
<a href="./">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li >
@ -323,7 +310,31 @@
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<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 class="active" >
<a href="./">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 >
@ -339,7 +350,7 @@
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../jobs/">Jobs</a>
</li>
</ul>
@ -427,9 +438,9 @@
<p>Significant new functionality in the 3.3 release includes:</p>
<ul>
<li>Filters presented as HTML controls in the browsable API.</li>
<li>A <a href="../html-and-forms/">forms API</a>, allowing serializers to be rendered as HTML forms.</li>
<li>A <a href="../../topics/html-and-forms/">forms API</a>, allowing serializers to be rendered as HTML forms.</li>
<li>Django 1.9 support.</li>
<li>A <a href="../../../api-guide/fields#jsonfield"><code>JSONField</code> serializer field</a>, corresponding to Django 1.9's Postgres <code>JSONField</code> model field.</li>
<li>A <a href="../../api-guide/fields#jsonfield"><code>JSONField</code> serializer field</a>, corresponding to Django 1.9's Postgres <code>JSONField</code> model field.</li>
<li>Browsable API support <a href="https://github.com/encode/ajax-form">via AJAX</a>, rather than server side request overloading.</li>
</ul>
<p><img alt="Filter Controls" src="../../img/filter-controls.png" /></p>
@ -442,8 +453,8 @@
<p>The AJAX based support for the browsable API means that there are a number of internal cleanups in the <code>request</code> class. For the vast majority of developers this should largely remain transparent:</p>
<ul>
<li>To support form based <code>PUT</code> and <code>DELETE</code>, or to support form content types such as JSON, you should now use the <a href="https://github.com/encode/ajax-form">AJAX forms</a> javascript library. This replaces the previous 'method and content type overloading' that required significant internal complexity to the request class.</li>
<li>The <code>accept</code> query parameter is no longer supported by the default content negotiation class. If you require it then you'll need to <a href="../browser-enhancements/#url-based-accept-headers">use a custom content negotiation class</a>.</li>
<li>The custom <code>HTTP_X_HTTP_METHOD_OVERRIDE</code> header is no longer supported by default. If you require it then you'll need to <a href="../browser-enhancements/#http-header-based-method-overriding">use custom middleware</a>.</li>
<li>The <code>accept</code> query parameter is no longer supported by the default content negotiation class. If you require it then you'll need to <a href="../../topics/browser-enhancements/#url-based-accept-headers">use a custom content negotiation class</a>.</li>
<li>The custom <code>HTTP_X_HTTP_METHOD_OVERRIDE</code> header is no longer supported by default. If you require it then you'll need to <a href="../../topics/browser-enhancements/#http-header-based-method-overriding">use custom middleware</a>.</li>
</ul>
<p>The following pagination view attributes and settings have been moved into attributes on the pagination class since 3.1. Their usage was formerly deprecated, and has now been removed entirely, in line with the deprecation policy.</p>
<ul>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>3.4 Announcement - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/3.4-announcement/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/3.4-announcement/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 3.4 Announcement">
<meta name="author" content="Tom Christie">
@ -58,10 +58,10 @@
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.5-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.3-announcement/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.3-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.5-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>
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
@ -287,35 +298,11 @@
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li class="active" >
<a href="./">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li >
@ -323,7 +310,31 @@
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li class="active" >
<a href="./">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 >
@ -339,7 +350,7 @@
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../jobs/">Jobs</a>
</li>
</ul>
@ -468,7 +479,7 @@ Right now we're over 60% of the way towards achieving that.
<hr />
<h2 id="schemas-client-libraries"><a class="toclink" href="#schemas-client-libraries">Schemas &amp; client libraries</a></h2>
<p>REST framework 3.4 brings built-in support for generating API schemas.</p>
<p>We provide this support by using <a href="http://www.coreapi.org/">Core API</a>, a Document Object Model
<p>We provide this support by using <a href="https://www.coreapi.org/">Core API</a>, a Document Object Model
for describing APIs.</p>
<p>Because Core API represents the API schema in an format-independent
manner, we're able to render the Core API <code>Document</code> object into many different
@ -504,19 +515,19 @@ documentation generation and parameter annotation.</p>
</thead>
<tbody>
<tr>
<td><a href="http://www.coreapi.org/specification/encoding/#core-json-encoding">Core JSON</a></td>
<td><a href="https://www.coreapi.org/specification/encoding/#core-json-encoding">Core JSON</a></td>
<td>Schema generation &amp; client support.</td>
<td>Built-in support in <code>coreapi</code></td>
<td>Built-in support in <code>coreapi</code>.</td>
</tr>
<tr>
<td><a href="https://openapis.org/specification">Swagger / OpenAPI</a></td>
<td>Schema generation &amp; client support.</td>
<td>The <code>openapi-codec</code>package.</td>
<td>The <code>openapi-codec</code> package.</td>
</tr>
<tr>
<td><a href="http://json-schema.org/latest/json-schema-hypermedia.html">JSON Hyper-Schema</a></td>
<td><a href="https://json-schema.org/latest/json-schema-hypermedia.html">JSON Hyper-Schema</a></td>
<td>Currently client support only.</td>
<td>The <code>hyperschema-codec</code>package.</td>
<td>The <code>hyperschema-codec</code> package.</td>
</tr>
<tr>
<td><a href="https://apiblueprint.org/">API Blueprint</a></td>
@ -528,9 +539,9 @@ documentation generation and parameter annotation.</p>
<hr />
<p>You can read more about any of this new functionality in the following:</p>
<ul>
<li>New tutorial section on <a href="../../../tutorial/7-schemas-and-client-libraries/">schemas &amp; client libraries</a>.</li>
<li>Documentation page on <a href="../../../api-guide/schemas/">schema generation</a>.</li>
<li>Topic page on <a href="../api-clients/">API clients</a>.</li>
<li>New tutorial section on <a href="../../tutorial/7-schemas-and-client-libraries/">schemas &amp; client libraries</a>.</li>
<li>Documentation page on <a href="../../api-guide/schemas/">schema generation</a>.</li>
<li>Topic page on <a href="../../topics/api-clients/">API clients</a>.</li>
</ul>
<p>It is also worth noting that Marc Gibbons is currently working towards a 2.0 release of
the popular Django REST Swagger package, which will tie in with our new built-in support.</p>
@ -572,7 +583,7 @@ will result in a list of the available choices being returned in the response.</
to return a list of available instances to choose from for that relational field.</p>
<p>In order to minimise exposed information the behavior now is to <em>not</em> return
choices information for relational fields.</p>
<p>If you want to override this new behavior you'll need to <a href="../../../api-guide/metadata/#custom-metadata-classes">implement a custom
<p>If you want to override this new behavior you'll need to <a href="../../api-guide/metadata/#custom-metadata-classes">implement a custom
metadata class</a>.</p>
<p>See <a href="https://github.com/encode/django-rest-framework/issues/3751">issue #3751</a> for more information on this behavioral change.</p>
<hr />

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>3.5 Announcement - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/3.5-announcement/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/3.5-announcement/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 3.5 Announcement">
<meta name="author" content="Tom Christie">
@ -58,10 +58,10 @@
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.6-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.4-announcement/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.4-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.6-announcement/">
<i class="icon-arrow-left icon-white"></i> Previous
</a>
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
@ -287,35 +298,11 @@
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li class="active" >
<a href="./">3.5 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li >
@ -323,7 +310,31 @@
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<a href="../3.6-announcement/">3.6 Announcement</a>
</li>
<li class="active" >
<a href="./">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 >
@ -339,7 +350,7 @@
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../jobs/">Jobs</a>
</li>
</ul>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>3.6 Announcement - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/3.6-announcement/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/3.6-announcement/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 3.6 Announcement">
<meta name="author" content="Tom Christie">
@ -58,10 +58,10 @@
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.7-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.5-announcement/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.5-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.7-announcement/">
<i class="icon-arrow-left icon-white"></i> Previous
</a>
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
@ -287,31 +298,15 @@
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li class="active" >
@ -319,11 +314,27 @@
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<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 >
@ -339,7 +350,7 @@
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../jobs/">Jobs</a>
</li>
</ul>
@ -501,7 +512,7 @@ urlpatterns = [
<p>We'll likely be making further refinements to the API documentation over the
coming weeks. Keep in mind that this is a new feature, and please do give
us feedback if you run into any issues or limitations.</p>
<p>For more information on documenting your API endpoints see the <a href="../documenting-your-api/">"Documenting your API"</a> section.</p>
<p>For more information on documenting your API endpoints see the <a href="../../topics/documenting-your-api/">"Documenting your API"</a> section.</p>
<hr />
<h2 id="javascript-client-library"><a class="toclink" href="#javascript-client-library">JavaScript client library</a></h2>
<p>The JavaScript client library allows you to load an API schema, and then interact
@ -539,7 +550,7 @@ used by your project itself, or as an external client interacting with your API.
<p>The client is not limited to usage with REST framework APIs, although it does
currently only support loading CoreJSON API schemas. Support for Swagger and
other API schemas is planned.</p>
<p>For more details see the <a href="../api-clients/#javascript-client-library">JavaScript client library documentation</a>.</p>
<p>For more details see the <a href="../../topics/api-clients/#javascript-client-library">JavaScript client library documentation</a>.</p>
<h2 id="authentication-classes-for-the-python-client-library"><a class="toclink" href="#authentication-classes-for-the-python-client-library">Authentication classes for the Python client library</a></h2>
<p>Previous authentication support in the Python client library was limited to
allowing users to provide explicit header values.</p>
@ -550,7 +561,7 @@ the introduction of the <code>BasicAuthentication</code>, <code>TokenAuthenticat
<pre><code>auth = coreapi.auth.TokenAuthentication(scheme='JWT', token='xxx-xxx-xxx')
client = coreapi.Client(auth=auth)
</code></pre>
<p>For more information see the <a href="../api-clients/#python-client-library">Python client library documentation</a>.</p>
<p>For more information see the <a href="../../topics/api-clients/#python-client-library">Python client library documentation</a>.</p>
<hr />
<h2 id="deprecations"><a class="toclink" href="#deprecations">Deprecations</a></h2>
<h3 id="updating-coreapi"><a class="toclink" href="#updating-coreapi">Updating coreapi</a></h3>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>3.7 Announcement - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/3.7-announcement/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/3.7-announcement/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 3.7 Announcement">
<meta name="author" content="Tom Christie">
@ -58,10 +58,10 @@
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.8-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.6-announcement/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.6-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.8-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>
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
@ -287,35 +298,11 @@
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li class="active" >
@ -323,7 +310,31 @@
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<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 >
@ -339,7 +350,7 @@
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../jobs/">Jobs</a>
</li>
</ul>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>3.8 Announcement - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/3.8-announcement/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/3.8-announcement/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 3.8 Announcement">
<meta name="author" content="Tom Christie">
@ -58,10 +58,10 @@
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../kickstarter-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.7-announcement/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.7-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="next" 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>
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
@ -287,31 +298,15 @@
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../release-notes/">Release Notes</a>
</li>
<li class="active" >
<a href="./">3.8 Announcement</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
<a href="../3.7-announcement/">3.7 Announcement</a>
</li>
<li >
@ -319,11 +314,27 @@
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li class="active" >
<a href="./">3.8 Announcement</a>
<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 >
@ -339,7 +350,7 @@
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../jobs/">Jobs</a>
</li>
</ul>
@ -454,7 +465,7 @@ the foundations for future changes.</p>
<p><em>We'd like to say thanks in particular our premium backers, <a href="http://jobs.rover.com/">Rover</a>, <a href="https://getsentry.com/welcome/">Sentry</a>, <a href="https://getstream.io/?utm_source=drf&amp;utm_medium=banner&amp;utm_campaign=drf">Stream</a>, <a href="https://hello.machinalis.co.uk/">Machinalis</a>, and <a href="https://rollbar.com">Rollbar</a>.</em></p>
<hr />
<h2 id="breaking-changes"><a class="toclink" href="#breaking-changes">Breaking Changes</a></h2>
<h3 id="altered-the-behaviour-of-read_only-plus-default-on-field"><code>default</code> on Field.<a class="toclink" href="#altered-the-behaviour-of-read_only-plus-default-on-field">Altered the behaviour of <code>read_only</code> plus </a></h3>
<h3 id="altered-the-behaviour-of-read_only-plus-default-on-field"><a class="toclink" href="#altered-the-behaviour-of-read_only-plus-default-on-field">Altered the behaviour of <code>read_only</code> plus <code>default</code> on Field.</a></h3>
<p><a href="https://github.com/encode/django-rest-framework/issues/5886">#5886</a> <code>read_only</code> fields will now <strong>always</strong> be excluded from writable fields.</p>
<p>Previously <code>read_only</code> fields when combined with a <code>default</code> value would use the <code>default</code> for create and update
operations. This was counter-intuitive in some circumstances and led to difficulties supporting dotted <code>source</code>
@ -467,7 +478,7 @@ the view:</p>
<p>Alternatively you may override <code>save()</code> or <code>create()</code> or <code>update()</code> on the serializer as appropriate.</p>
<hr />
<h2 id="deprecations"><a class="toclink" href="#deprecations">Deprecations</a></h2>
<h3 id="action-decorator-replaces-list_route-and-detail_route"><code>list_route</code> and <a class="toclink" href="#action-decorator-replaces-list_route-and-detail_route"><code>action</code> decorator replaces <code>detail_route</code></a></h3>
<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><a href="https://github.com/encode/django-rest-framework/issues/5705">#5705</a> <code>list_route</code> and <code>detail_route</code> have been merge into a single <code>action</code> decorator. This improves viewset action introspection, and will allow extra actions to be displayed in the Browsable API in future versions.</p>
<p>Both <code>list_route</code> and <code>detail_route</code> are now pending deprecation. They will be deprecated in 3.9 and removed entirely
in 3.10.</p>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Contributing to REST framework - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/contributing/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/contributing/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Contributing to REST framework">
<meta name="author" content="Tom Christie">
@ -61,7 +61,7 @@
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../project-management/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../tutorials-and-resources/">
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../third-party-packages/">
<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>
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li class="active" >
<a href="./">Contributing to REST framework</a>
</li>
@ -287,35 +298,11 @@
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li >
@ -323,7 +310,31 @@
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<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 >
@ -339,7 +350,7 @@
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../jobs/">Jobs</a>
</li>
</ul>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Funding - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/funding/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/funding/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Funding">
<meta name="author" content="Tom Christie">
@ -58,7 +58,7 @@
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../release-notes/">
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../jobs/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../mozilla-grant/">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
@ -287,35 +298,11 @@
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li >
@ -323,7 +310,31 @@
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<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 >
@ -339,7 +350,7 @@
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../jobs/">Jobs</a>
</li>
</ul>
@ -557,10 +568,10 @@ form.signup {
<hr />
<h2 id="what-funding-has-enabled-so-far"><a class="toclink" href="#what-funding-has-enabled-so-far">What funding has enabled so far</a></h2>
<ul>
<li>The <a href="http://www.django-rest-framework.org/topics/3.4-announcement/">3.4</a> and <a href="http://www.django-rest-framework.org/topics/3.5-announcement/">3.5</a> releases, including schema generation for both Swagger and RAML, a Python client library, a Command Line client, and addressing of a large number of outstanding issues.</li>
<li>The <a href="http://www.django-rest-framework.org/topics/3.6-announcement/">3.6</a> release, including JavaScript client library, and API documentation, complete with auto-generated code samples.</li>
<li>The <a href="http://www.django-rest-framework.org/topics/3.7-announcement/">3.7 release</a>, made possible due to our collaborative funding model, focuses on improvements to schema generation and the interactive API documentation.</li>
<li>The recent <a href="http://www.django-rest-framework.org/topics/3.8-announcement/">3.8 release</a>.</li>
<li>The <a href="https://www.django-rest-framework.org/topics/3.4-announcement/">3.4</a> and <a href="https://www.django-rest-framework.org/topics/3.5-announcement/">3.5</a> releases, including schema generation for both Swagger and RAML, a Python client library, a Command Line client, and addressing of a large number of outstanding issues.</li>
<li>The <a href="https://www.django-rest-framework.org/topics/3.6-announcement/">3.6</a> release, including JavaScript client library, and API documentation, complete with auto-generated code samples.</li>
<li>The <a href="https://www.django-rest-framework.org/topics/3.7-announcement/">3.7 release</a>, made possible due to our collaborative funding model, focuses on improvements to schema generation and the interactive API documentation.</li>
<li>The recent <a href="https://www.django-rest-framework.org/topics/3.8-announcement/">3.8 release</a>.</li>
<li>Tom Christie, the creator of Django REST framework, working on the project full-time.</li>
<li>Around 80-90 issues and pull requests closed per month since Tom Christie started working on the project full-time.</li>
<li>A community &amp; operations manager position part-time for 4 months, helping mature the business and grow sponsorship.</li>
@ -755,7 +766,7 @@ DRF is one of the core reasons why Django is top choice among web frameworks tod
<p>For further enquires please contact <a href=mailto:funding@django-rest-framework.org>funding@django-rest-framework.org</a>.</p>
<hr />
<h2 id="accountability"><a class="toclink" href="#accountability">Accountability</a></h2>
<p>In an effort to keep the project as transparent as possible, we are releasing <a href="http://www.encode.io/reports/march-2018">monthly progress reports</a> and regularly include financial reports and cost breakdowns.</p>
<p>In an effort to keep the project as transparent as possible, we are releasing <a href="https://www.encode.io/reports/march-2018">monthly progress reports</a> and regularly include financial reports and cost breakdowns.</p>
<!-- Begin MailChimp Signup Form -->
<p><link href="//cdn-images.mailchimp.com/embedcode/classic-10_7.css" rel="stylesheet" type="text/css">

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Jobs - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/jobs/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/jobs/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Jobs">
<meta name="author" content="Tom Christie">
@ -58,10 +58,10 @@
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.0-announcement/">
<a class="repo-link btn btn-inverse btn-small disabled" rel="prev" >
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../project-management/">
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../funding/">
<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>
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
@ -286,36 +297,12 @@
<a href="../project-management/">Project management</a>
</li>
<li class="active" >
<a href="./">Jobs</a>
<li >
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li >
@ -323,7 +310,31 @@
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<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 >
@ -338,8 +349,8 @@
<a href="../funding/">Funding</a>
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<li class="active" >
<a href="./">Jobs</a>
</li>
</ul>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Kickstarter Announcement - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/kickstarter-announcement/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/kickstarter-announcement/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Kickstarter Announcement">
<meta name="author" content="Tom Christie">
@ -61,7 +61,7 @@
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../mozilla-grant/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.8-announcement/">
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../3.0-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>
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
@ -287,35 +298,11 @@
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li >
@ -323,7 +310,31 @@
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<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 class="active" >
@ -339,7 +350,7 @@
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../jobs/">Jobs</a>
</li>
</ul>
@ -474,7 +485,7 @@
<li><a href="https://mirusresearch.com/" rel="nofollow" style="background-image:url(../../img/sponsors/2-mirus_research.png);">Mirus Research</a></li>
<li><a href="https://hipolabs.com/" rel="nofollow" style="background-image:url(../../img/sponsors/2-hipo.png);">Hipo</a></li>
<li><a href="https://www.byte.nl/" rel="nofollow" style="background-image:url(../../img/sponsors/2-byte.png);">Byte</a></li>
<li><a href="http://lightningkite.com/" rel="nofollow" style="background-image:url(../../img/sponsors/2-lightning_kite.png);">Lightning Kite</a></li>
<li><a href="https://www.lightningkite.com/" rel="nofollow" style="background-image:url(../../img/sponsors/2-lightning_kite.png);">Lightning Kite</a></li>
<li><a href="https://opbeat.com/" rel="nofollow" style="background-image:url(../../img/sponsors/2-opbeat.png);">Opbeat</a></li>
<li><a href="https://koordinates.com" rel="nofollow" style="background-image:url(../../img/sponsors/2-koordinates.png);">Koordinates</a></li>
<li><a href="http://pulsecode.ca" rel="nofollow" style="background-image:url(../../img/sponsors/2-pulsecode.png);">Pulsecode Inc.</a></li>
@ -509,7 +520,7 @@
<li><a href="https://garfo.io/" rel="nofollow" style="background-image:url(../../img/sponsors/3-garfo.png);">Garfo</a></li>
<li><a href="https://goshippo.com/" rel="nofollow" style="background-image:url(../../img/sponsors/3-shippo.png);">Shippo</a></li>
<li><a href="http://www.gizmag.com/" rel="nofollow" style="background-image:url(../../img/sponsors/3-gizmag.png);">Gizmag</a></li>
<li><a href="http://www.tivix.com/" rel="nofollow" style="background-image:url(../../img/sponsors/3-tivix.png);">Tivix</a></li>
<li><a href="https://www.tivix.com/" rel="nofollow" style="background-image:url(../../img/sponsors/3-tivix.png);">Tivix</a></li>
<li><a href="https://www.safaribooksonline.com/" rel="nofollow" style="background-image:url(../../img/sponsors/3-safari.png);">Safari</a></li>
<li><a href="http://brightloop.com/" rel="nofollow" style="background-image:url(../../img/sponsors/3-brightloop.png);">Bright Loop</a></li>
<li><a href="http://www.aba-systems.com.au/" rel="nofollow" style="background-image:url(../../img/sponsors/3-aba.png);">ABA Systems</a></li>
@ -524,7 +535,7 @@
<li><a href="https://fluxility.com/" rel="nofollow" style="background-image:url(../../img/sponsors/3-fluxility.png);">Fluxility</a></li>
<li><a href="https://teonite.com/" rel="nofollow" style="background-image:url(../../img/sponsors/3-teonite.png);">Teonite</a></li>
<li><a href="https://trackmaven.com/" rel="nofollow" style="background-image:url(../../img/sponsors/3-trackmaven.png);">TrackMaven</a></li>
<li><a href="http://www.phurba.net/" rel="nofollow" style="background-image:url(../../img/sponsors/3-phurba.png);">Phurba</a></li>
<li><a href="https://www.phurba.net/" rel="nofollow" style="background-image:url(../../img/sponsors/3-phurba.png);">Phurba</a></li>
<li><a href="https://www.nephila.it/it/" rel="nofollow" style="background-image:url(../../img/sponsors/3-nephila.png);">Nephila</a></li>
<li><a href="http://www.aditium.com/" rel="nofollow" style="background-image:url(../../img/sponsors/3-aditium.png);">Aditium</a></li>
<li><a href="https://www.eyesopen.com/" rel="nofollow" style="background-image:url(../../img/sponsors/3-openeye.png);">OpenEye Scientific Software</a></li>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Mozilla Grant - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/mozilla-grant/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/mozilla-grant/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Mozilla Grant">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
@ -287,35 +298,11 @@
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li >
@ -323,7 +310,31 @@
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<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 >
@ -339,7 +350,7 @@
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../jobs/">Jobs</a>
</li>
</ul>
@ -420,7 +431,7 @@
<h1 id="mozilla-grant"><a class="toclink" href="#mozilla-grant">Mozilla Grant</a></h1>
<p>We have recently been <a href="https://blog.mozilla.org/blog/2016/04/13/mozilla-open-source-support-moss-update-q1-2016/">awarded a Mozilla grant</a>, in order to fund the next major releases of REST framework. This work will focus on seamless client-side integration by introducing supporting client libraries that are able to dynamically interact with REST framework APIs. The framework will provide for either hypermedia or schema endpoints, which will expose the available interface for the client libraries to interact with.</p>
<p>Additionally, we will be building on the realtime support that Django Channels provides, supporting and documenting how to build realtime APIs with REST framework. Again, this will include supporting work in the associated client libraries, making it easier to build richly interactive applications.</p>
<p>The <a href="http://www.coreapi.org">Core API</a> project will provide the foundations for our client library support, and will allow us to support interaction using a wide range of schemas and hypermedia formats. It's worth noting that these client libraries won't be tightly coupled to solely REST framework APIs either, and will be able to interact with <em>any</em> API that exposes a supported schema or hypermedia format.</p>
<p>The <a href="https://www.coreapi.org/">Core API</a> project will provide the foundations for our client library support, and will allow us to support interaction using a wide range of schemas and hypermedia formats. It's worth noting that these client libraries won't be tightly coupled to solely REST framework APIs either, and will be able to interact with <em>any</em> API that exposes a supported schema or hypermedia format.</p>
<p>Specifically, the work includes:</p>
<h2 id="client-libraries"><a class="toclink" href="#client-libraries">Client libraries</a></h2>
<p>This work will include built-in schema and hypermedia support, allowing dynamic client libraries to interact with the API. I'll also be releasing both Python and Javascript client libraries, plus a command-line client, a new tutorial section, and further documentation.</p>
@ -444,7 +455,7 @@
<p>In order to ensure that I can be fully focused on trying to secure a sustainable
&amp; well-funded open source business I will be leaving my current role at <a href="https://www.dabapps.com/">DabApps</a>
at the end of May 2016.</p>
<p>I have formed a UK limited company, <a href="http://www.encode.io">Encode</a>, which will
<p>I have formed a UK limited company, <a href="https://www.encode.io/">Encode</a>, which will
act as the business entity behind REST framework. I will be issuing monthly reports
from Encode on progress both towards the Mozilla grant, and for development time
funded via the <a href="../funding/">REST framework paid plans</a>.</p>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Project management - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/project-management/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/project-management/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Project management">
<meta name="author" content="Tom Christie">
@ -58,7 +58,7 @@
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../jobs/">
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../release-notes/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../contributing/">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
@ -287,35 +298,11 @@
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li >
@ -323,7 +310,31 @@
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<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 >
@ -339,7 +350,7 @@
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../jobs/">Jobs</a>
</li>
</ul>
@ -456,7 +467,7 @@
<p>The following template should be used for the description of the issue, and serves as the formal process for selecting the team.</p>
<pre><code>This issue is for determining the maintenance team for the *** period.
Please see the [Project management](http://www.django-rest-framework.org/topics/project-management/) section of our documentation for more details.
Please see the [Project management](https://www.django-rest-framework.org/topics/project-management/) section of our documentation for more details.
---
@ -476,7 +487,7 @@ The following people are the current maintenance team. Please checkmark your nam
If you wish to be considered for this or a future date, please comment against this or subsequent issues.
To modify this process for future maintenance cycles make a pull request to the [project management](http://www.django-rest-framework.org/topics/project-management/) documentation.
To modify this process for future maintenance cycles make a pull request to the [project management](https://www.django-rest-framework.org/topics/project-management/) documentation.
</code></pre>
<h4 id="responsibilities-of-team-members"><a class="toclink" href="#responsibilities-of-team-members">Responsibilities of team members</a></h4>
<p>Team members have the following responsibilities.</p>
@ -510,7 +521,7 @@ Pull request is #***.
During development cycle:
- [ ] Upload the new content to be translated to [transifex](http://www.django-rest-framework.org/topics/project-management/#translations).
- [ ] Upload the new content to be translated to [transifex](https://www.django-rest-framework.org/topics/project-management/#translations).
Checklist:
@ -521,7 +532,7 @@ Checklist:
- [ ] `setup.py` Python &amp; Django version trove classifiers
- [ ] `README` Python &amp; Django versions
- [ ] `docs` Python &amp; Django versions
- [ ] Update the translations from [transifex](http://www.django-rest-framework.org/topics/project-management/#translations).
- [ ] Update the translations from [transifex](https://www.django-rest-framework.org/topics/project-management/#translations).
- [ ] Ensure the pull request increments the version to `*.*.*` in [`restframework/__init__.py`](https://github.com/encode/django-rest-framework/blob/master/rest_framework/__init__.py).
- [ ] Confirm with @tomchristie that release is finalized and ready to go.
- [ ] Ensure that release date is included in pull request.
@ -533,7 +544,7 @@ Checklist:
- [ ] Make a release announcement on twitter.
- [ ] Close the milestone on GitHub.
To modify this process for future releases make a pull request to the [project management](http://www.django-rest-framework.org/topics/project-management/) documentation.
To modify this process for future releases make a pull request to the [project management](https://www.django-rest-framework.org/topics/project-management/) documentation.
</code></pre>
<p>When pushing the release to PyPI ensure that your environment has been installed from our development <code>requirement.txt</code>, so that documentation and PyPI installs are consistently being built against a pinned set of packages.</p>
<hr />
@ -554,7 +565,7 @@ hostname = https://www.transifex.com
<p>When any user visible strings are changed, they should be uploaded to Transifex so that the translators can start to translate them. To do this, just run:</p>
<pre><code># 1. Update the source django.po file, which is the US English version.
cd rest_framework
django-admin.py makemessages -l en_US
django-admin makemessages -l en_US
# 2. Push the source django.po file to Transifex.
cd ..
tx push -s
@ -572,7 +583,7 @@ tx push -s
tx pull -a --minimum-perc 10
cd rest_framework
# 4. Compile the binary .mo files for all supported languages.
django-admin.py compilemessages
django-admin compilemessages
</code></pre>
<hr />
<h2 id="project-requirements"><a class="toclink" href="#project-requirements">Project requirements</a></h2>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Release Notes - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/release-notes/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/release-notes/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Release Notes">
<meta name="author" content="Tom Christie">
@ -58,10 +58,10 @@
<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 disabled" rel="prev" >
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../3.8-announcement/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../funding/">
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../project-management/">
<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>
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
@ -286,36 +297,12 @@
<a href="../project-management/">Project management</a>
</li>
<li >
<a href="../jobs/">Jobs</a>
<li class="active" >
<a href="./">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li >
@ -323,7 +310,31 @@
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<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 >
@ -338,8 +349,8 @@
<a href="../funding/">Funding</a>
</li>
<li class="active" >
<a href="./">Release Notes</a>
<li >
<a href="../jobs/">Jobs</a>
</li>
</ul>
@ -402,6 +413,10 @@
<a href="#upgrading">Upgrading</a>
</li>
<li>
<a href="#39x-series">3.9.x series</a>
</li>
<li>
<a href="#38x-series">3.8.x series</a>
</li>
@ -485,6 +500,14 @@
<pre><code>pip show djangorestframework
</code></pre>
<hr />
<h2 id="39x-series"><a class="toclink" href="#39x-series">3.9.x series</a></h2>
<h3 id="390"><a class="toclink" href="#390">3.9.0</a></h3>
<p><strong>Date</strong>: Unreleased</p>
<ul>
<li>Deprecate the <code>Router.register</code> <code>base_name</code> argument in favor of <code>basename</code>. <a href="https://github.com/encode/django-rest-framework/issues/5990">#5990</a></li>
<li>Deprecate the <code>Router.get_default_base_name</code> method in favor of <code>Router.get_default_basename</code>. <a href="https://github.com/encode/django-rest-framework/issues/5990">#5990</a></li>
<li>Deprecate the <code>DjangoObjectPermissionsFilter</code> class, moved to the <code>djangorestframework-guardian</code> package. <a href="https://github.com/encode/django-rest-framework/issues/6075">#6075</a></li>
</ul>
<h2 id="38x-series"><a class="toclink" href="#38x-series">3.8.x series</a></h2>
<h3 id="382"><a class="toclink" href="#382">3.8.2</a></h3>
<p><strong>Date</strong>: <a href="https://github.com/encode/django-rest-framework/milestone/68?closed=1">6th April 2018</a></p>
@ -1395,13 +1418,20 @@ Previously may have been stored internally as <code>None</code>.</p>
<p>For older release notes, <a href="https://github.com/encode/django-rest-framework/blob/version-2.4.x/docs/topics/release-notes.md">please see the version 2.x documentation</a>.</p>
<!-- 3.0.1 -->
<p><!-- 3.0.2 -->
<!-- 3.0.2 -->
<!-- 3.0.3 -->
<!-- 3.0.4 -->
<!-- 3.0.5 -->
<!-- 3.1.1 -->
<!-- 3.1.2 -->
<!-- 3.1.3 --></p>
<!-- 3.1.3 -->
<!-- 3.2.0 -->
<!-- 3.2.1 -->
@ -1471,6 +1501,8 @@ Previously may have been stored internally as <code>None</code>.</p>
<!-- 3.8.1 -->
<!-- 3.8.2 -->
<!-- 3.9.0 -->
</div> <!--/span-->

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Third Party Packages - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/third-party-packages/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/third-party-packages/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Third Party Packages">
<meta name="author" content="Tom Christie">
@ -58,10 +58,10 @@
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../tutorials-and-resources/">
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../contributing/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../rest-hypermedia-hateoas/">
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../tutorials-and-resources/">
<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>
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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 class="active" >
<a href="./">Third Party Packages</a>
</li>
<li >
<a href="../tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
@ -287,35 +298,11 @@
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li >
@ -323,7 +310,31 @@
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<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 >
@ -339,7 +350,7 @@
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../jobs/">Jobs</a>
</li>
</ul>
@ -457,7 +468,7 @@ version (default is "0.1.0")?
<p>If you use the cookiecutter template, your project will already contain a <code>.travis.yml</code> file which Travis CI will use to build your project and run tests. By default, builds are triggered everytime you push to your repository or create Pull Request.</p>
<h4 id="uploading-to-pypi"><a class="toclink" href="#uploading-to-pypi">Uploading to PyPI</a></h4>
<p>Once you've got at least a prototype working and tests running, you should publish it on PyPI to allow others to install it via <code>pip</code>.</p>
<p>You must <a href="https://pypi.python.org/pypi?%3Aaction=register_form">register</a> an account before publishing to PyPI.</p>
<p>You must <a href="https://pypi.org/account/register/">register</a> an account before publishing to PyPI.</p>
<p>To register your package on PyPI run the following command.</p>
<pre><code>$ python setup.py register
</code></pre>
@ -538,7 +549,6 @@ You probably want to also tag the version now:
<ul>
<li><a href="https://github.com/juanriaza/django-rest-framework-digestauth">djangorestframework-digestauth</a> - Provides Digest Access Authentication support.</li>
<li><a href="https://github.com/evonove/django-oauth-toolkit">django-oauth-toolkit</a> - Provides OAuth 2.0 support.</li>
<li><a href="https://github.com/Rediker-Software/doac">doac</a> - Provides OAuth 2.0 support.</li>
<li><a href="https://github.com/GetBlimp/django-rest-framework-jwt">djangorestframework-jwt</a> - Provides JSON Web Token Authentication support.</li>
<li><a href="https://github.com/davesque/django-rest-framework-simplejwt">djangorestframework-simplejwt</a> - An alternative package that provides JSON Web Token Authentication support.</li>
<li><a href="https://github.com/kumar303/hawkrest">hawkrest</a> - Provides Hawk HTTP Authorization.</li>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Tutorials and Resources - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/tutorials-and-resources/" />
<link rel="canonical" href="https://www.django-rest-framework.org/community/tutorials-and-resources/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Tutorials and Resources">
<meta name="author" content="Tom Christie">
@ -58,10 +58,10 @@
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../contributing/">
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../third-party-packages/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../third-party-packages/">
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../../topics/rest-hypermedia-hateoas/">
<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>
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -234,50 +238,57 @@
</ul>
</li>
<li class="dropdown active">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api/">Documenting your API</a>
<a href="../../topics/documenting-your-api/">Documenting your API</a>
</li>
<li >
<a href="../api-clients/">API Clients</a>
<a href="../../topics/api-clients/">API Clients</a>
</li>
<li >
<a href="../internationalization/">Internationalization</a>
<a href="../../topics/internationalization/">Internationalization</a>
</li>
<li >
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../html-and-forms/">HTML & Forms</a>
<a href="../../topics/html-and-forms/">HTML & Forms</a>
</li>
<li >
<a href="../browser-enhancements/">Browser Enhancements</a>
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
</li>
<li >
<a href="../browsable-api/">The Browsable API</a>
<a href="../../topics/browsable-api/">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
<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 class="active" >
<a href="./">Tutorials and Resources</a>
</li>
<li >
<a href="../third-party-packages/">Third Party Packages</a>
</li>
<li class="active" >
<a href="./">Tutorials and Resources</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
</li>
@ -287,35 +298,11 @@
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../3.8-announcement/">3.8 Announcement</a>
</li>
<li >
@ -323,7 +310,31 @@
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<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 >
@ -339,7 +350,7 @@
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../jobs/">Jobs</a>
</li>
</ul>
@ -431,6 +442,12 @@
<a class="book-cover" href="https://www.twoscoopspress.com/products/two-scoops-of-django-1-11">
<img src="../../img/books/tsd-cover.png"/>
</a>
<a class="book-cover" href="https://wsvincent.com/books/">
<img src="../../img/books/rad-cover.png"/>
</a>
<a class="book-cover" href="https://books.agiliq.com/projects/django-api-polls-tutorial/en/latest/">
<img src="../../img/books/bda-cover.png"/>
</a>
</div>
<h2 id="tutorials"><a class="toclink" href="#tutorials">Tutorials</a></h2>
@ -440,8 +457,8 @@
<li><a href="https://tests4geeks.com/django-rest-framework-tutorial/">Django REST Framework Tutorial</a></li>
<li><a href="https://teamtreehouse.com/library/django-rest-framework">Django REST Framework Course</a></li>
<li><a href="https://agiliq.com/blog/2014/12/building-a-restful-api-with-django-rest-framework/">Building a RESTful API with Django REST Framework</a></li>
<li><a href="http://blog.kevinastone.com/getting-started-with-django-rest-framework-and-angularjs.html">Getting Started with Django REST Framework and AngularJS</a></li>
<li><a href="http://mourafiq.com/2013/07/01/end-to-end-web-app-with-django-angular-1.html">End to End Web App with Django REST Framework &amp; AngularJS</a></li>
<li><a href="https://blog.kevinastone.com/getting-started-with-django-rest-framework-and-angularjs.html">Getting Started with Django REST Framework and AngularJS</a></li>
<li><a href="https://mourafiq.com/2013/07/01/end-to-end-web-app-with-django-angular-1.html">End to End Web App with Django REST Framework &amp; AngularJS</a></li>
<li><a href="https://godjango.com/41-start-your-api-django-rest-framework-part-1/">Start Your API - Django REST Framework Part 1</a></li>
<li><a href="https://godjango.com/43-permissions-authentication-django-rest-framework-part-2/">Permissions &amp; Authentication - Django REST Framework Part 2</a></li>
<li><a href="https://godjango.com/45-viewsets-and-routers-django-rest-framework-part-3/">ViewSets and Routers - Django REST Framework Part 3</a></li>

View File

@ -3,7 +3,7 @@
*
* Copyright 2012 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
*/

2
css/bootstrap.css vendored
View File

@ -3,7 +3,7 @@
*
* Copyright 2012 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
*/

BIN
img/books/bda-cover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
img/books/rad-cover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Home - Django REST framework</title>
<link href="./img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/" />
<link rel="canonical" href="https://www.django-rest-framework.org/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Home">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="topics/third-party-packages/">Third Party Packages</a>
<a href="community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="topics/contributing/">Contributing to REST framework</a>
<a href="community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="topics/project-management/">Project management</a>
<a href="community/project-management/">Project management</a>
</li>
<li >
<a href="topics/jobs/">Jobs</a>
<a href="community/release-notes/">Release Notes</a>
</li>
<li >
<a href="topics/3.0-announcement/">3.0 Announcement</a>
<a href="community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="topics/3.1-announcement/">3.1 Announcement</a>
<a href="community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="topics/3.2-announcement/">3.2 Announcement</a>
<a href="community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="topics/3.3-announcement/">3.3 Announcement</a>
<a href="community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="topics/3.4-announcement/">3.4 Announcement</a>
<a href="community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="topics/3.5-announcement/">3.5 Announcement</a>
<a href="community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="topics/3.6-announcement/">3.6 Announcement</a>
<a href="community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="topics/3.7-announcement/">3.7 Announcement</a>
<a href="community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="topics/3.8-announcement/">3.8 Announcement</a>
<a href="community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="topics/mozilla-grant/">Mozilla Grant</a>
<a href="community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="topics/funding/">Funding</a>
<a href="community/funding/">Funding</a>
</li>
<li >
<a href="topics/release-notes/">Release Notes</a>
<a href="community/jobs/">Jobs</a>
</li>
</ul>
@ -419,24 +430,6 @@
<li class="">
<a href="#tutorial">Tutorial</a>
</li>
<li class="">
<a href="#api-guide">API Guide</a>
</li>
<li class="">
<a href="#topics">Topics</a>
</li>
<li class="">
<a href="#development">Development</a>
</li>
@ -506,8 +499,6 @@
</a>
</p>
<hr />
<p><strong>Note</strong>: This is the documentation for the <strong>version 3</strong> of REST framework. Documentation for <a href="https://tomchristie.github.io/rest-framework-2-docs/">version 2</a> is also available.</p>
<hr />
<p>
<h1 style="position: absolute;
@ -536,7 +527,7 @@
<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="topics/funding/">signing up for a paid plan</a></strong>.</p>
continued development by <strong><a href="community/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="http://jobs.rover.com/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)">Rover.com</a></li>
@ -545,17 +536,18 @@ continued development by <strong><a href="topics/funding/">signing up for a paid
<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>
<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="http://jobs.rover.com/">Rover</a>, <a href="https://getsentry.com/welcome/">Sentry</a>, <a href="https://getstream.io/?utm_source=drf&amp;utm_medium=banner&amp;utm_campaign=drf">Stream</a>, <a href="https://rollbar.com">Rollbar</a>, <a href="https://cadre.com">Cadre</a>, and <a href="https://loadimpact.com/?utm_campaign=Sponsorship%20links&amp;utm_source=drf&amp;utm_medium=drf">Load Impact</a>.</em></p>
<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="http://jobs.rover.com/">Rover</a>, <a href="https://getsentry.com/welcome/">Sentry</a>, <a href="https://getstream.io/?utm_source=drf&amp;utm_medium=banner&amp;utm_campaign=drf">Stream</a>, <a href="https://rollbar.com">Rollbar</a>, <a href="https://cadre.com">Cadre</a>, <a href="https://loadimpact.com/?utm_campaign=Sponsorship%20links&amp;utm_source=drf&amp;utm_medium=drf">Load Impact</a>, and <a href="https://hubs.ly/H0f30Lf0">Kloudless</a>.</em></p>
<hr />
<h2 id="requirements"><a class="toclink" href="#requirements">Requirements</a></h2>
<p>REST framework requires the following:</p>
<ul>
<li>Python (2.7, 3.2, 3.3, 3.4, 3.5, 3.6)</li>
<li>Django (1.10, 1.11, 2.0)</li>
<li>Python (2.7, 3.4, 3.5, 3.6, 3.7)</li>
<li>Django (1.11, 2.0, 2.1)</li>
</ul>
<p>The following packages are optional:</p>
<ul>
@ -631,81 +623,8 @@ urlpatterns = [
<p>You can now open the API in your browser at <a href="http://127.0.0.1:8000/">http://127.0.0.1:8000/</a>, and view your new 'users' API. If you use the login control in the top right corner you'll also be able to add, create and delete users from the system.</p>
<h2 id="quickstart"><a class="toclink" href="#quickstart">Quickstart</a></h2>
<p>Can't wait to get started? The <a href="tutorial/quickstart/">quickstart guide</a> is the fastest way to get up and running, and building APIs with REST framework.</p>
<h2 id="tutorial"><a class="toclink" href="#tutorial">Tutorial</a></h2>
<p>The tutorial will walk you through the building blocks that make up REST framework. It'll take a little while to get through, but it'll give you a comprehensive understanding of how everything fits together, and is highly recommended reading.</p>
<ul>
<li><a href="tutorial/1-serialization/">1 - Serialization</a></li>
<li><a href="tutorial/2-requests-and-responses/">2 - Requests &amp; 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 &amp; permissions</a></li>
<li><a href="tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships &amp; hyperlinked APIs</a></li>
<li><a href="tutorial/6-viewsets-and-routers/">6 - Viewsets &amp; routers</a></li>
<li><a href="tutorial/7-schemas-and-client-libraries/">7 - Schemas &amp; client libraries</a></li>
</ul>
<p>There is a live example API of the finished tutorial API for testing purposes, <a href="https://restframework.herokuapp.com/">available here</a>.</p>
<h2 id="api-guide"><a class="toclink" href="#api-guide">API Guide</a></h2>
<p>The API guide is your complete reference manual to all the functionality provided by REST framework.</p>
<ul>
<li><a href="api-guide/requests/">Requests</a></li>
<li><a href="api-guide/responses/">Responses</a></li>
<li><a href="api-guide/views/">Views</a></li>
<li><a href="api-guide/generic-views/">Generic views</a></li>
<li><a href="api-guide/viewsets/">Viewsets</a></li>
<li><a href="api-guide/routers/">Routers</a></li>
<li><a href="api-guide/parsers/">Parsers</a></li>
<li><a href="api-guide/renderers/">Renderers</a></li>
<li><a href="api-guide/serializers/">Serializers</a></li>
<li><a href="api-guide/fields/">Serializer fields</a></li>
<li><a href="api-guide/relations/">Serializer relations</a></li>
<li><a href="api-guide/validators/">Validators</a></li>
<li><a href="api-guide/authentication/">Authentication</a></li>
<li><a href="api-guide/permissions/">Permissions</a></li>
<li><a href="api-guide/throttling/">Throttling</a></li>
<li><a href="api-guide/filtering/">Filtering</a></li>
<li><a href="api-guide/pagination/">Pagination</a></li>
<li><a href="api-guide/versioning/">Versioning</a></li>
<li><a href="api-guide/content-negotiation/">Content negotiation</a></li>
<li><a href="api-guide/metadata/">Metadata</a></li>
<li><a href="api-guide/schemas/">Schemas</a></li>
<li><a href="api-guide/format-suffixes/">Format suffixes</a></li>
<li><a href="api-guide/reverse/">Returning URLs</a></li>
<li><a href="api-guide/exceptions/">Exceptions</a></li>
<li><a href="api-guide/status-codes/">Status codes</a></li>
<li><a href="api-guide/testing/">Testing</a></li>
<li><a href="api-guide/settings/">Settings</a></li>
</ul>
<h2 id="topics"><a class="toclink" href="#topics">Topics</a></h2>
<p>General guides to using REST framework.</p>
<ul>
<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 &amp; CORS</a></li>
<li><a href="topics/html-and-forms/">HTML &amp; 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 &amp; HATEOAS</a></li>
<li><a href="topics/third-party-packages/">Third Party Packages</a></li>
<li><a href="topics/tutorials-and-resources/">Tutorials and Resources</a></li>
<li><a href="topics/contributing/">Contributing to REST framework</a></li>
<li><a href="topics/project-management/">Project management</a></li>
<li><a href="topics/3.0-announcement/">3.0 Announcement</a></li>
<li><a href="topics/3.1-announcement/">3.1 Announcement</a></li>
<li><a href="topics/3.2-announcement/">3.2 Announcement</a></li>
<li><a href="topics/3.3-announcement/">3.3 Announcement</a></li>
<li><a href="topics/3.4-announcement/">3.4 Announcement</a></li>
<li><a href="topics/3.5-announcement/">3.5 Announcement</a></li>
<li><a href="topics/3.6-announcement/">3.6 Announcement</a></li>
<li><a href="topics/3.7-announcement/">3.7 Announcement</a></li>
<li><a href="topics/3.8-announcement/">3.8 Announcement</a></li>
<li><a href="topics/kickstarter-announcement/">Kickstarter Announcement</a></li>
<li><a href="topics/mozilla-grant/">Mozilla Grant</a></li>
<li><a href="topics/funding/">Funding</a></li>
<li><a href="topics/release-notes/">Release Notes</a></li>
<li><a href="topics/jobs/">Jobs</a></li>
</ul>
<h2 id="development"><a class="toclink" href="#development">Development</a></h2>
<p>See the <a href="topics/contributing/">Contribution guidelines</a> for information on how to clone
<p>See the <a href="community/contributing/">Contribution guidelines</a> for information on how to clone
the repository, run the test suite and contribute changes back to REST
Framework.</p>
<h2 id="support"><a class="toclink" href="#support">Support</a></h2>
@ -718,15 +637,26 @@ Framework.</p>
<p>If you believe youve found something in Django REST framework which has security implications, please <strong>do not raise the issue in a public forum</strong>.</p>
<p>Send a description of the issue via email to <a href="mailto:rest-framework-security@googlegroups.com">rest-framework-security@googlegroups.com</a>. The project maintainers will then work with you to resolve any issues where required, prior to any public disclosure.</p>
<h2 id="license"><a class="toclink" href="#license">License</a></h2>
<p>Copyright (c) 2011-2017, Tom Christie
<p>Copyright © 2011-present, <a href="https://www.encode.io/">Encode OSS Ltd</a>.
All rights reserved.</p>
<p>Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:</p>
<ul>
<li>
<p>Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.</p>
list of conditions and the following disclaimer.</p>
</li>
<li>
<p>Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.</p>
</li>
<li>
<p>Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.</p>
</li>
</ul>
<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE

File diff suppressed because one or more lines are too long

View File

@ -3,8 +3,8 @@
<url>
<loc>http://www.django-rest-framework.org//</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
@ -12,50 +12,50 @@
<url>
<loc>http://www.django-rest-framework.org//tutorial/quickstart/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//tutorial/quickstart/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//tutorial/1-serialization/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//tutorial/1-serialization/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//tutorial/2-requests-and-responses/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//tutorial/2-requests-and-responses/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//tutorial/3-class-based-views/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//tutorial/3-class-based-views/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//tutorial/4-authentication-and-permissions/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//tutorial/4-authentication-and-permissions/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//tutorial/5-relationships-and-hyperlinked-apis/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//tutorial/5-relationships-and-hyperlinked-apis/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//tutorial/6-viewsets-and-routers/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//tutorial/6-viewsets-and-routers/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//tutorial/7-schemas-and-client-libraries/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//tutorial/7-schemas-and-client-libraries/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
@ -64,164 +64,170 @@
<url>
<loc>http://www.django-rest-framework.org//api-guide/requests/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/requests/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/responses/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/responses/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/views/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/views/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/generic-views/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/generic-views/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/viewsets/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/viewsets/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/routers/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/routers/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/parsers/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/parsers/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/renderers/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/renderers/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/serializers/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/serializers/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/fields/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/fields/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/relations/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/relations/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/validators/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/validators/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/authentication/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/authentication/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/permissions/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/permissions/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/throttling/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/caching/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/filtering/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/throttling/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/pagination/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/filtering/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/versioning/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/pagination/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/content-negotiation/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/versioning/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/metadata/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/content-negotiation/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/schemas/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/metadata/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/format-suffixes/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/schemas/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/reverse/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/format-suffixes/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/exceptions/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/reverse/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/status-codes/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/exceptions/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/testing/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/status-codes/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//api-guide/settings/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//api-guide/testing/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org//api-guide/settings/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
@ -230,158 +236,162 @@
<url>
<loc>http://www.django-rest-framework.org//topics/documenting-your-api/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//topics/documenting-your-api/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/api-clients/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//topics/api-clients/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/internationalization/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//topics/internationalization/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/ajax-csrf-cors/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//topics/ajax-csrf-cors/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/html-and-forms/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//topics/html-and-forms/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/browser-enhancements/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//topics/browser-enhancements/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/browsable-api/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//topics/browsable-api/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/rest-hypermedia-hateoas/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//topics/rest-hypermedia-hateoas/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org//community/tutorials-and-resources/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/third-party-packages/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//community/third-party-packages/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/tutorials-and-resources/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//community/contributing/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/contributing/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//community/project-management/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/project-management/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//community/release-notes/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/jobs/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//community/3.8-announcement/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/3.0-announcement/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//community/3.7-announcement/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/3.1-announcement/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//community/3.6-announcement/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/3.2-announcement/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//community/3.5-announcement/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/3.3-announcement/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//community/3.4-announcement/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/3.4-announcement/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//community/3.3-announcement/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/3.5-announcement/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//community/3.2-announcement/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/3.6-announcement/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//community/3.1-announcement/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/3.7-announcement/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//community/3.0-announcement/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/3.8-announcement/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//community/kickstarter-announcement/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/kickstarter-announcement/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//community/mozilla-grant/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/mozilla-grant/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//community/funding/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/funding/</loc>
<lastmod>2018-09-14</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.django-rest-framework.org//topics/release-notes/</loc>
<lastmod>2018-09-14</lastmod>
<loc>https://www.django-rest-framework.org//community/jobs/</loc>
<lastmod>2018-10-11</lastmod>
<changefreq>daily</changefreq>
</url>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>AJAX, CSRF & CORS - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/ajax-csrf-cors/" />
<link rel="canonical" href="https://www.django-rest-framework.org/topics/ajax-csrf-cors/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, AJAX, CSRF & CORS">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>API Clients - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/api-clients/" />
<link rel="canonical" href="https://www.django-rest-framework.org/topics/api-clients/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, API Clients">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -491,9 +502,9 @@ interface to work against, rather than working directly with the network interfa
They can be used with any API that exposes a supported schema format.</p>
<p>For example, <a href="https://devcenter.heroku.com/categories/platform-api">the Heroku platform API</a> exposes a schema in the JSON
Hyperschema format. As a result, the Core API command line client and Python
client library can be <a href="http://www.coreapi.org/tools-and-resources/example-services/#heroku-json-hyper-schema">used to interact with the Heroku API</a>.</p>
client library can be <a href="https://www.coreapi.org/tools-and-resources/example-services/#heroku-json-hyper-schema">used to interact with the Heroku API</a>.</p>
<h2 id="client-side-core-api"><a class="toclink" href="#client-side-core-api">Client-side Core API</a></h2>
<p><a href="http://www.coreapi.org/">Core API</a> is a document specification that can be used to describe APIs. It can
<p><a href="https://www.coreapi.org/">Core API</a> is a document specification that can be used to describe APIs. It can
be used either server-side, as is done with REST framework's <a href="../../api-guide/schemas/">schema generation</a>,
or used client-side, as described here.</p>
<p>When used client-side, Core API allows for <em>dynamically driven client libraries</em>
@ -678,7 +689,7 @@ instantiating the client.</p>
<p>The <code>TokenAuthentication</code> class can be used to support REST framework's built-in
<code>TokenAuthentication</code>, as well as OAuth and JWT schemes.</p>
<pre><code>auth = coreapi.auth.TokenAuthentication(
scheme='JWT'
scheme='JWT',
token='&lt;token&gt;'
)
client = coreapi.Client(auth=auth)
@ -691,8 +702,8 @@ request to an "obtain token" endpoint</p>
<pre><code>client = coreapi.Client()
schema = client.get('https://api.example.org/')
action = ['api-token-auth', 'obtain-token']
params = {username: "example", email: "example@example.com"}
action = ['api-token-auth', 'create']
params = {"username": "example", "password": "secret"}
result = client.action(schema, action, params)
auth = coreapi.auth.TokenAuthentication(

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>The Browsable API - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/browsable-api/" />
<link rel="canonical" href="https://www.django-rest-framework.org/topics/browsable-api/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, The Browsable API">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Browser Enhancements - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/browser-enhancements/" />
<link rel="canonical" href="https://www.django-rest-framework.org/topics/browser-enhancements/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Browser Enhancements">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -444,7 +455,7 @@
...
&lt;/form&gt;
</code></pre>
<p>Note that prior to 3.3.0, this support was server-side rather than javascript based. The method overloading style (as used in <a href="http://guides.rubyonrails.org/form_helpers.html#how-do-forms-with-put-or-delete-methods-work">Ruby on Rails</a>) is no longer supported due to subtle issues that it introduces in request parsing.</p>
<p>Note that prior to 3.3.0, this support was server-side rather than javascript based. The method overloading style (as used in <a href="https://guides.rubyonrails.org/form_helpers.html#how-do-forms-with-put-or-delete-methods-work">Ruby on Rails</a>) is no longer supported due to subtle issues that it introduces in request parsing.</p>
<h2 id="browser-based-submission-of-non-form-content"><a class="toclink" href="#browser-based-submission-of-non-form-content">Browser based submission of non-form content</a></h2>
<p>Browser-based submission of content types such as JSON are supported by the <a href="https://github.com/encode/ajax-form">AJAX form library</a>, using form fields with <code>data-override='content-type'</code> and <code>data-override='content'</code> attributes.</p>
<p>For example:</p>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Documenting your API - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/documenting-your-api/" />
<link rel="canonical" href="https://www.django-rest-framework.org/topics/documenting-your-api/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Documenting your API">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -424,7 +435,7 @@
<h1 id="documenting-your-api"><a class="toclink" href="#documenting-your-api">Documenting your API</a></h1>
<blockquote>
<p>A REST API should spend almost all of its descriptive effort in defining the media type(s) used for representing resources and driving application state.</p>
<p>&mdash; Roy Fielding, <a href="http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven">REST APIs must be hypertext driven</a></p>
<p>&mdash; Roy Fielding, <a href="https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven">REST APIs must be hypertext driven</a></p>
</blockquote>
<p>REST framework provides built-in support for API documentation. There are also a number of great third-party documentation tools available.</p>
<h2 id="built-in-api-documentation"><a class="toclink" href="#built-in-api-documentation">Built-in API documentation</a></h2>
@ -435,10 +446,10 @@
<li>Support for API interaction.</li>
</ul>
<h3 id="installation"><a class="toclink" href="#installation">Installation</a></h3>
<p>The <code>coreapi</code> library is required as a dependancy for the API docs. Make sure
<p>The <code>coreapi</code> library is required as a dependency for the API docs. Make sure
to install the latest version. The <code>pygments</code> and <code>markdown</code> libraries
are optional but recommended.</p>
<p>To install the API documentation, you'll need to include it in your projects URLconf:</p>
<p>To install the API documentation, you'll need to include it in your project's URLconf:</p>
<pre><code>from rest_framework.documentation import include_docs_urls
urlpatterns = [
@ -454,7 +465,7 @@ urlpatterns = [
<hr />
<p><strong>Note</strong>: By default <code>include_docs_urls</code> configures the underlying <code>SchemaView</code> to generate <em>public</em> schemas.
This means that views will not be instantiated with a <code>request</code> instance. i.e. Inside the view <code>self.request</code> will be <code>None</code>.</p>
<p>To be compatible with this behaviour methods (such as <code>get_serializer</code> or <code>get_serializer_class</code> etc.) which inspect <code>self.request</code> or, particularly, <code>self.request.user</code> may need to be adjusted to handle this case.</p>
<p>To be compatible with this behaviour, methods (such as <code>get_serializer</code> or <code>get_serializer_class</code> etc.) which inspect <code>self.request</code> or, particularly, <code>self.request.user</code> may need to be adjusted to handle this case.</p>
<p>You may ensure views are given a <code>request</code> instance by calling <code>include_docs_urls</code> with <code>public=False</code>:</p>
<pre><code>from rest_framework.documentation import include_docs_urls
@ -496,6 +507,27 @@ For example:</p>
Create a new user instance.
"""
</code></pre>
<p>Custom actions on viewsets can also be documented in a similar way using the method names
as delimiters or by attaching the documentation to action mapping methods.</p>
<pre><code>class UserViewSet(viewsets.ModelViewset):
...
@action(detail=False, methods=['get', 'post'])
def some_action(self, request, *args, **kwargs):
"""
get:
A description of the get method on the custom action.
post:
A description of the post method on the custom action.
"""
@some_action.mapping.put
def put_some_action():
"""
A description of the put method on the custom action.
"""
</code></pre>
<h3 id="documentation-api-reference"><a class="toclink" href="#documentation-api-reference"><code>documentation</code> API Reference</a></h3>
<p>The <code>rest_framework.documentation</code> module provides three helper functions to help configure the interactive API documentation, <code>include_docs_urls</code> (usage shown above), <code>get_docs_view</code> and <code>get_schemajs_view</code>.</p>
<p><code>include_docs_urls</code> employs <code>get_docs_view</code> and <code>get_schemajs_view</code> to generate the url patterns for the documentation page and JavaScript resource that exposes the API schema respectively. They expose the following options for customisation. (<code>get_docs_view</code> and <code>get_schemajs_view</code> ultimately call <code>rest_frameworks.schemas.get_schema_view()</code>, see the Schemas docs for more options there.)</p>
@ -632,7 +664,7 @@ out-of-the-box by Django Rest Framework. Its goals are:</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/#example">Schemas as documentation: Examples</a>.</p>
<p>Note that when using viewsets the basic docstring is used for all generated views. To provide descriptions for each view, such as for the the list and retrieve views, use docstring sections as described in <a href="../../api-guide/schemas/#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

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>HTML & Forms - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/html-and-forms/" />
<link rel="canonical" href="https://www.django-rest-framework.org/topics/html-and-forms/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, HTML & Forms">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -418,9 +429,9 @@
<h1 id="html-forms"><a class="toclink" href="#html-forms">HTML &amp; Forms</a></h1>
<p>REST framework is suitable for returning both API style responses, and regular HTML pages. Additionally, serializers can used as HTML forms and rendered in templates.</p>
<p>REST framework is suitable for returning both API style responses, and regular HTML pages. Additionally, serializers can be used as HTML forms and rendered in templates.</p>
<h2 id="rendering-html"><a class="toclink" href="#rendering-html">Rendering HTML</a></h2>
<p>In order to return HTML responses you'll need to either <code>TemplateHTMLRenderer</code>, or <code>StaticHTMLRenderer</code>.</p>
<p>In order to return HTML responses you'll need to use either <code>TemplateHTMLRenderer</code>, or <code>StaticHTMLRenderer</code>.</p>
<p>The <code>TemplateHTMLRenderer</code> class expects the response to contain a dictionary of context data, and renders an HTML page based on a template that must be specified either in the view or on the response.</p>
<p>The <code>StaticHTMLRender</code> class expects the response to contain a string of the pre-rendered HTML content.</p>
<p>Because static HTML pages typically have different behavior from API responses you'll probably need to write any HTML views explicitly, rather than relying on the built-in generic views.</p>
@ -605,22 +616,22 @@ class ProfileDetail(APIView):
</tr>
<tr>
<td>select.html</td>
<td><code>ChoiceField</code>or relational field types</td>
<td><code>ChoiceField</code> or relational field types</td>
<td>hide_label</td>
</tr>
<tr>
<td>radio.html</td>
<td><code>ChoiceField</code>or relational field types</td>
<td><code>ChoiceField</code> or relational field types</td>
<td>inline, hide_label</td>
</tr>
<tr>
<td>select_multiple.html</td>
<td><code>MultipleChoiceField</code>or relational fields with <code>many=True</code></td>
<td><code>MultipleChoiceField</code> or relational fields with <code>many=True</code></td>
<td>hide_label</td>
</tr>
<tr>
<td>checkbox_multiple.html</td>
<td><code>MultipleChoiceField</code>or relational fields with <code>many=True</code></td>
<td><code>MultipleChoiceField</code> or relational fields with <code>many=True</code></td>
<td>inline, hide_label</td>
</tr>
<tr>
@ -635,7 +646,7 @@ class ProfileDetail(APIView):
</tr>
<tr>
<td>list_fieldset.html</td>
<td><code>ListField</code>or nested serializer with <code>many=True</code></td>
<td><code>ListField</code> or nested serializer with <code>many=True</code></td>
<td>hide_label</td>
</tr>
</tbody>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Internationalization - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/internationalization/" />
<link rel="canonical" href="https://www.django-rest-framework.org/topics/internationalization/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Internationalization">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -452,7 +463,7 @@ Host: example.org
</code></pre>
<p>REST framework includes these built-in translations both for standard exception cases, and for serializer validation errors.</p>
<p>Note that the translations only apply to the error strings themselves. The format of error messages, and the keys of field names will remain the same. An example <code>400 Bad Request</code> response body might look like this:</p>
<pre><code>{"detail": {"username": ["Esse campo deve ser unico."]}}
<pre><code>{"detail": {"username": ["Esse campo deve ser único."]}}
</code></pre>
<p>If you want to use different string for parts of the response such as <code>detail</code> and <code>non_field_errors</code> then you can modify this behavior by using a <a href="../../api-guide/exceptions/#custom-exception-handling">custom exception handler</a>.</p>
<h4 id="specifying-the-set-of-supported-languages"><a class="toclink" href="#specifying-the-set-of-supported-languages">Specifying the set of supported languages.</a></h4>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>REST, Hypermedia & HATEOAS - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/rest-hypermedia-hateoas/" />
<link rel="canonical" href="https://www.django-rest-framework.org/topics/rest-hypermedia-hateoas/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, REST, Hypermedia & HATEOAS">
<meta name="author" content="Tom Christie">
@ -58,7 +58,7 @@
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/encode/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../third-party-packages/">
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../../community/tutorials-and-resources/">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../browsable-api/">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="./">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -428,7 +439,7 @@
<ul>
<li>Roy Fielding's dissertation - <a href="https://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm">Architectural Styles and
the Design of Network-based Software Architectures</a>.</li>
<li>Roy Fielding's "<a href="http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven">REST APIs must be hypertext-driven</a>" blog post.</li>
<li>Roy Fielding's "<a href="https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven">REST APIs must be hypertext-driven</a>" blog post.</li>
<li>Leonard Richardson &amp; Mike Amundsen's <a href="http://restfulwebapis.org/">RESTful Web APIs</a>.</li>
<li>Mike Amundsen's <a href="https://www.amazon.com/Building-Hypermedia-APIs-HTML5-Node/dp/1449306578">Building Hypermedia APIs with HTML5 and Node</a>.</li>
<li>Steve Klabnik's <a href="http://designinghypermediaapis.com/">Designing Hypermedia APIs</a>.</li>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>1 - Serialization - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/tutorial/1-serialization/" />
<link rel="canonical" href="https://www.django-rest-framework.org/tutorial/1-serialization/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 1 - Serialization">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -467,7 +478,7 @@ pip install pygments # We'll be using this for the code highlighting
<p>Okay, we're ready to get coding.
To get started, let's create a new project to work with.</p>
<pre><code>cd ~
django-admin.py startproject tutorial
django-admin startproject tutorial
cd tutorial
</code></pre>
<p>Once that's done we can create an app that we'll use to create a simple Web API.</p>
@ -570,9 +581,9 @@ content
# '{"id": 2, "title": "", "code": "print \\"hello, world\\"\\n", "linenos": false, "language": "python", "style": "friendly"}'
</code></pre>
<p>Deserialization is similar. First we parse a stream into Python native datatypes...</p>
<pre><code>from django.utils.six import BytesIO
<pre><code>import io
stream = BytesIO(content)
stream = io.BytesIO(content)
data = JSONParser().parse(stream)
</code></pre>
<p>...then we restore those native datatypes into a fully populated object instance.</p>
@ -676,19 +687,19 @@ def snippet_detail(request, pk):
return HttpResponse(status=204)
</code></pre>
<p>Finally we need to wire these views up. Create the <code>snippets/urls.py</code> file:</p>
<pre><code>from django.conf.urls import url
<pre><code>from django.urls import path
from snippets import views
urlpatterns = [
url(r'^snippets/$', views.snippet_list),
url(r'^snippets/(?P&lt;pk&gt;[0-9]+)/$', views.snippet_detail),
path('snippets/', views.snippet_list),
path('snippets/&lt;int:pk&gt;/', views.snippet_detail),
]
</code></pre>
<p>We also need to wire up the root urlconf, in the <code>tutorial/urls.py</code> file, to include our snippet app's URLs.</p>
<pre><code>from django.conf.urls import url, include
<pre><code>from django.urls import path, include
urlpatterns = [
url(r'^', include('snippets.urls')),
path('', include('snippets.urls')),
]
</code></pre>
<p>It's worth noting that there are a couple of edge cases we're not dealing with properly at the moment. If we send malformed <code>json</code>, or if a request is made with a method that the view doesn't handle, then we'll end up with a 500 "server error" response. Still, this'll do for now.</p>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>2 - Requests and responses - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/tutorial/2-requests-and-responses/" />
<link rel="canonical" href="https://www.django-rest-framework.org/tutorial/2-requests-and-responses/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 2 - Requests and responses">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -524,13 +535,13 @@ def snippet_detail(request, pk):
<pre><code>def snippet_detail(request, pk, format=None):
</code></pre>
<p>Now update the <code>snippets/urls.py</code> file slightly, to append a set of <code>format_suffix_patterns</code> in addition to the existing URLs.</p>
<pre><code>from django.conf.urls import url
<pre><code>from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from snippets import views
urlpatterns = [
url(r'^snippets/$', views.snippet_list),
url(r'^snippets/(?P&lt;pk&gt;[0-9]+)$', views.snippet_detail),
path('snippets/', views.snippet_list),
path('snippets/&lt;int:pk&gt;', views.snippet_detail),
]
urlpatterns = format_suffix_patterns(urlpatterns)

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>3 - Class based views - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/tutorial/3-class-based-views/" />
<link rel="canonical" href="https://www.django-rest-framework.org/tutorial/3-class-based-views/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 3 - Class based views">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -476,13 +487,13 @@ class SnippetList(APIView):
</code></pre>
<p>That's looking good. Again, it's still pretty similar to the function based view right now.</p>
<p>We'll also need to refactor our <code>snippets/urls.py</code> slightly now that we're using class-based views.</p>
<pre><code>from django.conf.urls import url
<pre><code>from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from snippets import views
urlpatterns = [
url(r'^snippets/$', views.SnippetList.as_view()),
url(r'^snippets/(?P&lt;pk&gt;[0-9]+)/$', views.SnippetDetail.as_view()),
path('snippets/', views.SnippetList.as_view()),
path('snippets/&lt;int:pk&gt;/', views.SnippetDetail.as_view()),
]
urlpatterns = format_suffix_patterns(urlpatterns)

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>4 - Authentication and permissions - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/tutorial/4-authentication-and-permissions/" />
<link rel="canonical" href="https://www.django-rest-framework.org/tutorial/4-authentication-and-permissions/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 4 - Authentication and permissions">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -514,13 +525,13 @@ class UserDetail(generics.RetrieveAPIView):
<p>Make sure to also import the <code>UserSerializer</code> class</p>
<pre><code>from snippets.serializers import UserSerializer
</code></pre>
<p>Finally we need to add those views into the API, by referencing them from the URL conf. Add the following to the patterns in <code>urls.py</code>.</p>
<pre><code>url(r'^users/$', views.UserList.as_view()),
url(r'^users/(?P&lt;pk&gt;[0-9]+)/$', views.UserDetail.as_view()),
<p>Finally we need to add those views into the API, by referencing them from the URL conf. Add the following to the patterns in <code>snippets/urls.py</code>.</p>
<pre><code>path('users/', views.UserList.as_view()),
path('users/&lt;int:pk&gt;/', views.UserDetail.as_view()),
</code></pre>
<h2 id="associating-snippets-with-users"><a class="toclink" href="#associating-snippets-with-users">Associating Snippets with Users</a></h2>
<p>Right now, if we created a code snippet, there'd be no way of associating the user that created the snippet, with the snippet instance. The user isn't sent as part of the serialized representation, but is instead a property of the incoming request.</p>
<p>The way we deal with that is by overriding a <code>perform_create()</code> method on our snippet views, that allows us to modify how the instance save is managed, and handle any information that is implicit in the incoming request or requested URL.</p>
<p>The way we deal with that is by overriding a <code>.perform_create()</code> method on our snippet views, that allows us to modify how the instance save is managed, and handle any information that is implicit in the incoming request or requested URL.</p>
<p>On the <code>SnippetList</code> view class, add the following method:</p>
<pre><code>def perform_create(self, serializer):
serializer.save(owner=self.request.user)
@ -550,10 +561,10 @@ url(r'^users/(?P&lt;pk&gt;[0-9]+)/$', views.UserDetail.as_view()),
</code></pre>
<p>And, at the end of the file, add a pattern to include the login and logout views for the browsable API.</p>
<pre><code>urlpatterns += [
url(r'^api-auth/', include('rest_framework.urls')),
path('api-auth/', include('rest_framework.urls')),
]
</code></pre>
<p>The <code>r'^api-auth/'</code> part of pattern can actually be whatever URL you want to use.</p>
<p>The <code>'api-auth/'</code> part of pattern can actually be whatever URL you want to use.</p>
<p>Now if you open up the browser again and refresh the page you'll see a 'Login' link in the top right of the page. If you log in as one of the users you created earlier, you'll be able to create code snippets again.</p>
<p>Once you've created a few code snippets, navigate to the '/users/' endpoint, and notice that the representation includes a list of the snippet ids that are associated with each user, in each user's 'snippets' field.</p>
<h2 id="object-level-permissions"><a class="toclink" href="#object-level-permissions">Object level permissions</a></h2>
@ -660,4 +671,4 @@ class IsOwnerOrReadOnly(permissions.BasePermission):
</script>
</body>
</html>
</html>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>5 - Relationships and hyperlinked APIs - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/tutorial/5-relationships-and-hyperlinked-apis/" />
<link rel="canonical" href="https://www.django-rest-framework.org/tutorial/5-relationships-and-hyperlinked-apis/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 5 - Relationships and hyperlinked APIs">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -464,10 +475,10 @@ class SnippetHighlight(generics.GenericAPIView):
</code></pre>
<p>As usual we need to add the new views that we've created in to our URLconf.
We'll add a url pattern for our new API root in <code>snippets/urls.py</code>:</p>
<pre><code>url(r'^$', views.api_root),
<pre><code>path('', views.api_root),
</code></pre>
<p>And then add a url pattern for the snippet highlights:</p>
<pre><code>url(r'^snippets/(?P&lt;pk&gt;[0-9]+)/highlight/$', views.SnippetHighlight.as_view()),
<pre><code>path('snippets/&lt;int:pk&gt;/highlight/', views.SnippetHighlight.as_view()),
</code></pre>
<h2 id="hyperlinking-our-api"><a class="toclink" href="#hyperlinking-our-api">Hyperlinking our API</a></h2>
<p>Dealing with relationships between entities is one of the more challenging aspects of Web API design. There are a number of different ways that we might choose to represent a relationship:</p>
@ -523,20 +534,20 @@ from snippets import views
# API endpoints
urlpatterns = format_suffix_patterns([
url(r'^$', views.api_root),
url(r'^snippets/$',
path('', views.api_root),
path('snippets/',
views.SnippetList.as_view(),
name='snippet-list'),
url(r'^snippets/(?P&lt;pk&gt;[0-9]+)/$',
path('snippets/&lt;int:pk&gt;/',
views.SnippetDetail.as_view(),
name='snippet-detail'),
url(r'^snippets/(?P&lt;pk&gt;[0-9]+)/highlight/$',
path('snippets/&lt;int:pk&gt;/highlight/',
views.SnippetHighlight.as_view(),
name='snippet-highlight'),
url(r'^users/$',
path('users/',
views.UserList.as_view(),
name='user-list'),
url(r'^users/(?P&lt;pk&gt;[0-9]+)/$',
path('users/&lt;int:pk&gt;/',
views.UserDetail.as_view(),
name='user-detail')
])

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>6 - Viewsets and routers - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/" />
<link rel="canonical" href="https://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 6 - Viewsets and routers">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -496,18 +507,18 @@ user_detail = UserViewSet.as_view({
<p>Notice how we're creating multiple views from each <code>ViewSet</code> class, by binding the http methods to the required action for each view.</p>
<p>Now that we've bound our resources into concrete views, we can register the views with the URL conf as usual.</p>
<pre><code>urlpatterns = format_suffix_patterns([
url(r'^$', api_root),
url(r'^snippets/$', snippet_list, name='snippet-list'),
url(r'^snippets/(?P&lt;pk&gt;[0-9]+)/$', snippet_detail, name='snippet-detail'),
url(r'^snippets/(?P&lt;pk&gt;[0-9]+)/highlight/$', snippet_highlight, name='snippet-highlight'),
url(r'^users/$', user_list, name='user-list'),
url(r'^users/(?P&lt;pk&gt;[0-9]+)/$', user_detail, name='user-detail')
path('', api_root),
path('snippets/', snippet_list, name='snippet-list'),
path('snippets/&lt;int:pk&gt;/', snippet_detail, name='snippet-detail'),
path('snippets/&lt;int:pk&gt;/highlight/', snippet_highlight, name='snippet-highlight'),
path('users/', user_list, name='user-list'),
path('users/&lt;int:pk&gt;/', user_detail, name='user-detail')
])
</code></pre>
<h2 id="using-routers"><a class="toclink" href="#using-routers">Using Routers</a></h2>
<p>Because we're using <code>ViewSet</code> classes rather than <code>View</code> classes, we actually don't need to design the URL conf ourselves. The conventions for wiring up resources into views and urls can be handled automatically, using a <code>Router</code> class. All we need to do is register the appropriate view sets with a router, and let it do the rest.</p>
<p>Here's our re-wired <code>snippets/urls.py</code> file.</p>
<pre><code>from django.conf.urls import url, include
<pre><code>from django.urls import path, include
from rest_framework.routers import DefaultRouter
from snippets import views
@ -518,7 +529,7 @@ router.register(r'users', views.UserViewSet)
# The API URLs are now determined automatically by the router.
urlpatterns = [
url(r'^', include(router.urls))
path('', include(router.urls)),
]
</code></pre>
<p>Registering the viewsets with the router is similar to providing a urlpattern. We include two arguments - the URL prefix for the views, and the viewset itself.</p>

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>7 - Schemas and client libraries - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/tutorial/7-schemas-and-client-libraries/" />
<link rel="canonical" href="https://www.django-rest-framework.org/tutorial/7-schemas-and-client-libraries/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, 7 - Schemas and client libraries">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -435,7 +446,7 @@ endpoints, their URLS, and what operations they support.</p>
<p>Schemas can be a useful tool for auto-generated documentation, and can also
be used to drive dynamic client libraries that can interact with the API.</p>
<h2 id="core-api"><a class="toclink" href="#core-api">Core API</a></h2>
<p>In order to provide schema support REST framework uses <a href="http://www.coreapi.org">Core API</a>.</p>
<p>In order to provide schema support REST framework uses <a href="https://www.coreapi.org/">Core API</a>.</p>
<p>Core API is a document specification for describing APIs. It is used to provide
an internal representation format of the available endpoints and possible
interactions that an API exposes. It can either be used server-side, or
@ -460,7 +471,7 @@ view in our URL configuration.</p>
schema_view = get_schema_view(title='Pastebin API')
urlpatterns = [
   url(r'^schema/$', schema_view),
   path('schema/', schema_view),
...
]
</code></pre>
@ -482,7 +493,7 @@ Content-Type: application/coreapi+json
"_type": "document",
...
</code></pre>
<p>The default output style is to use the <a href="http://www.coreapi.org/specification/encoding/#core-json-encoding">Core JSON</a> encoding.</p>
<p>The default output style is to use the <a href="https://www.coreapi.org/specification/encoding/#core-json-encoding">Core JSON</a> encoding.</p>
<p>Other schema formats, such as <a href="https://openapis.org/">Open API</a> (formerly Swagger) are
also supported.</p>
<h2 id="using-a-command-line-client"><a class="toclink" href="#using-a-command-line-client">Using a command line client</a></h2>
@ -498,7 +509,7 @@ Usage: coreapi [OPTIONS] COMMAND [ARGS]...
Command line client for interacting with CoreAPI services.
Visit http://www.coreapi.org for more information.
Visit https://www.coreapi.org/ for more information.
Options:
--version Display the package version number.

View File

@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>Quickstart - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/tutorial/quickstart/" />
<link rel="canonical" href="https://www.django-rest-framework.org/tutorial/quickstart/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Quickstart">
<meta name="author" content="Tom Christie">
@ -70,7 +70,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<a class="brand" href="https://www.django-rest-framework.org/">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
@ -179,6 +179,10 @@
<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>
@ -270,76 +274,83 @@
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../topics/third-party-packages/">Third Party Packages</a>
<a href="../../community/tutorials-and-resources/">Tutorials and Resources</a>
</li>
<li >
<a href="../../topics/tutorials-and-resources/">Tutorials and Resources</a>
<a href="../../community/third-party-packages/">Third Party Packages</a>
</li>
<li >
<a href="../../topics/contributing/">Contributing to REST framework</a>
<a href="../../community/contributing/">Contributing to REST framework</a>
</li>
<li >
<a href="../../topics/project-management/">Project management</a>
<a href="../../community/project-management/">Project management</a>
</li>
<li >
<a href="../../topics/jobs/">Jobs</a>
<a href="../../community/release-notes/">Release Notes</a>
</li>
<li >
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
<a href="../../community/3.8-announcement/">3.8 Announcement</a>
</li>
<li >
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
<a href="../../community/3.7-announcement/">3.7 Announcement</a>
</li>
<li >
<a href="../../topics/3.2-announcement/">3.2 Announcement</a>
<a href="../../community/3.6-announcement/">3.6 Announcement</a>
</li>
<li >
<a href="../../topics/3.3-announcement/">3.3 Announcement</a>
<a href="../../community/3.5-announcement/">3.5 Announcement</a>
</li>
<li >
<a href="../../topics/3.4-announcement/">3.4 Announcement</a>
<a href="../../community/3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../../topics/3.5-announcement/">3.5 Announcement</a>
<a href="../../community/3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../../topics/3.6-announcement/">3.6 Announcement</a>
<a href="../../community/3.2-announcement/">3.2 Announcement</a>
</li>
<li >
<a href="../../topics/3.7-announcement/">3.7 Announcement</a>
<a href="../../community/3.1-announcement/">3.1 Announcement</a>
</li>
<li >
<a href="../../topics/3.8-announcement/">3.8 Announcement</a>
<a href="../../community/3.0-announcement/">3.0 Announcement</a>
</li>
<li >
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
<a href="../../community/kickstarter-announcement/">Kickstarter Announcement</a>
</li>
<li >
<a href="../../topics/mozilla-grant/">Mozilla Grant</a>
<a href="../../community/mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../../topics/funding/">Funding</a>
<a href="../../community/funding/">Funding</a>
</li>
<li >
<a href="../../topics/release-notes/">Release Notes</a>
<a href="../../community/jobs/">Jobs</a>
</li>
</ul>
@ -406,6 +417,10 @@
<a href="#urls">URLs</a>
</li>
<li>
<a href="#pagination">Pagination</a>
</li>
<li>
<a href="#settings">Settings</a>
</li>
@ -446,9 +461,9 @@ pip install django
pip install djangorestframework
# Set up a new project with a single application
django-admin.py startproject tutorial . # Note the trailing '.' character
django-admin startproject tutorial . # Note the trailing '.' character
cd tutorial
django-admin.py startapp quickstart
django-admin startapp quickstart
cd ..
</code></pre>
<p>The project layout should look like:</p>
@ -479,7 +494,7 @@ $ find .
<p>We'll also create an initial user named <code>admin</code> with a password of <code>password123</code>. We'll authenticate as that user later in our example.</p>
<pre><code>python manage.py createsuperuser --email admin@example.com --username admin
</code></pre>
<p>Once you've set up a database and initial user created and ready to go, open up the app's directory and we'll get coding...</p>
<p>Once you've set up a database and the initial user is created and ready to go, open up the app's directory and we'll get coding...</p>
<h2 id="serializers"><a class="toclink" href="#serializers">Serializers</a></h2>
<p>First up we're going to define some serializers. Let's create a new module named <code>tutorial/quickstart/serializers.py</code> that we'll use for our data representations.</p>
<pre><code>from django.contrib.auth.models import User, Group
@ -542,6 +557,13 @@ urlpatterns = [
<p>Because we're using viewsets instead of views, we can automatically generate the URL conf for our API, by simply registering the viewsets with a router class.</p>
<p>Again, if we need more control over the API URLs we can simply drop down to using regular class-based views, and writing the URL conf explicitly.</p>
<p>Finally, we're including default login and logout views for use with the browsable API. That's optional, but useful if your API requires authentication and you want to use the browsable API.</p>
<h2 id="pagination"><a class="toclink" href="#pagination">Pagination</a></h2>
<p>Pagination allows you to control how many objects per page are returned. To enable it add following lines to the <code>tutorial/settings.py</code></p>
<pre><code>REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 10
}
</code></pre>
<h2 id="settings"><a class="toclink" href="#settings">Settings</a></h2>
<p>Add <code>'rest_framework'</code> to <code>INSTALLED_APPS</code>. The settings module will be in <code>tutorial/settings.py</code></p>
<pre><code>INSTALLED_APPS = (