mirror of
https://github.com/encode/django-rest-framework.git
synced 2026-03-04 12:01:21 +03:00
Deployed f56ec95 with MkDocs version: 1.6.1
This commit is contained in:
parent
842f82c77a
commit
e35b0dddfc
22
404.html
22
404.html
|
|
@ -342,9 +342,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="/." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2514,6 +2512,22 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2576,7 +2590,7 @@
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "/", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "/assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "/", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "/assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2601,6 +2599,54 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-cache-with-apiview-and-viewsets" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using cache with apiview and viewsets
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-cache-with-api_view-decorator" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using cache with @api_view decorator
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2797,7 +2843,7 @@ other cache decorators such as <a href="https://docs.djangoproject.com/en/stable
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@
|
|||
<div data-md-component="skip">
|
||||
|
||||
|
||||
<a href="#content-negotiation" class="md-skip">
|
||||
<a href="#determining-the-accepted-renderer" class="md-skip">
|
||||
Skip to content
|
||||
</a>
|
||||
|
||||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -1265,8 +1263,6 @@
|
|||
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||
|
||||
|
|
@ -1309,8 +1305,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
|
|
@ -1327,6 +1321,45 @@
|
|||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-content-negotiation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom content negotiation
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom content negotiation">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setting-the-content-negotiation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setting the content negotiation
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -2590,6 +2623,80 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#determining-the-accepted-renderer" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Determining the accepted renderer
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-content-negotiation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom content negotiation
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom content negotiation">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setting-the-content-negotiation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setting the content negotiation
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2651,7 +2758,8 @@
|
|||
|
||||
|
||||
|
||||
<h1 id="content-negotiation">Content negotiation<a class="headerlink" href="#content-negotiation" title="Permanent link">¶</a></h1>
|
||||
<h1>Content negotiation</h1>
|
||||
|
||||
<blockquote>
|
||||
<p>HTTP has provisions for several mechanisms for "content negotiation" - the process of selecting the best representation for a given response when there are multiple representations available.</p>
|
||||
<p>— <a href="https://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html">RFC 2616</a>, Fielding et al.</p>
|
||||
|
|
@ -2679,12 +2787,12 @@
|
|||
<p>"q" values are not taken into account by REST framework when determining preference. The use of "q" values negatively impacts caching, and in the author's opinion they are an unnecessary and overcomplicated approach to content negotiation.</p>
|
||||
<p>This is a valid approach as the HTTP spec deliberately underspecifies how a server should weight server-based preferences against client-based preferences.</p>
|
||||
</div>
|
||||
<h1 id="custom-content-negotiation">Custom content negotiation<a class="headerlink" href="#custom-content-negotiation" title="Permanent link">¶</a></h1>
|
||||
<h2 id="custom-content-negotiation">Custom content negotiation<a class="headerlink" href="#custom-content-negotiation" title="Permanent link">¶</a></h2>
|
||||
<p>It's unlikely that you'll want to provide a custom content negotiation scheme for REST framework, but you can do so if needed. To implement a custom content negotiation scheme override <code>BaseContentNegotiation</code>.</p>
|
||||
<p>REST framework's content negotiation classes handle selection of both the appropriate parser for the request, and the appropriate renderer for the response, so you should implement both the <code>.select_parser(request, parsers)</code> and <code>.select_renderer(request, renderers, format_suffix)</code> methods.</p>
|
||||
<p>The <code>select_parser()</code> method should return one of the parser instances from the list of available parsers, or <code>None</code> if none of the parsers can handle the incoming request.</p>
|
||||
<p>The <code>select_renderer()</code> method should return a two-tuple of (renderer instance, media type), or raise a <code>NotAcceptable</code> exception.</p>
|
||||
<h2 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h2>
|
||||
<h3 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h3>
|
||||
<p>The following is a custom content negotiation class which ignores the client
|
||||
request when selecting the appropriate parser or renderer.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>from rest_framework.negotiation import BaseContentNegotiation
|
||||
|
|
@ -2702,7 +2810,7 @@ class IgnoreClientContentNegotiation(BaseContentNegotiation):
|
|||
"""
|
||||
return (renderers[0], renderers[0].media_type)
|
||||
</code></pre></div>
|
||||
<h2 id="setting-the-content-negotiation">Setting the content negotiation<a class="headerlink" href="#setting-the-content-negotiation" title="Permanent link">¶</a></h2>
|
||||
<h3 id="setting-the-content-negotiation">Setting the content negotiation<a class="headerlink" href="#setting-the-content-negotiation" title="Permanent link">¶</a></h3>
|
||||
<p>The default content negotiation class may be set globally, using the <code>DEFAULT_CONTENT_NEGOTIATION_CLASS</code> setting. For example, the following settings would use our example <code>IgnoreClientContentNegotiation</code> class.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>REST_FRAMEWORK = {
|
||||
'DEFAULT_CONTENT_NEGOTIATION_CLASS': 'myapp.negotiation.IgnoreClientContentNegotiation',
|
||||
|
|
@ -2786,7 +2894,7 @@ class NoNegotiationView(APIView):
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -1478,6 +1476,228 @@
|
|||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-reference" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Reference
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Reference">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#apiexception" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
APIException
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="APIException">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#inspecting-api-exceptions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Inspecting API exceptions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#parseerror" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ParseError
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#authenticationfailed" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
AuthenticationFailed
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#notauthenticated" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
NotAuthenticated
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#permissiondenied" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
PermissionDenied
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#notfound" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
NotFound
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#methodnotallowed" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
MethodNotAllowed
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#notacceptable" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
NotAcceptable
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#unsupportedmediatype" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
UnsupportedMediaType
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#throttled" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Throttled
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#validationerror" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ValidationError
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#generic-error-views" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Generic Error Views
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Generic Error Views">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#rest_frameworkexceptionsserver_error" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
rest_framework.exceptions.server_error
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#rest_frameworkexceptionsbad_request" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
rest_framework.exceptions.bad_request
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third party packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Third party packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-standardized-errors" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DRF Standardized Errors
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -2601,6 +2821,276 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#exception-handling-in-rest-framework-views" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Exception handling in REST framework views
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-exception-handling" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom exception handling
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-reference" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Reference
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Reference">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#apiexception" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
APIException
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="APIException">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#inspecting-api-exceptions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Inspecting API exceptions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#parseerror" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ParseError
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#authenticationfailed" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
AuthenticationFailed
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#notauthenticated" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
NotAuthenticated
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#permissiondenied" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
PermissionDenied
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#notfound" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
NotFound
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#methodnotallowed" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
MethodNotAllowed
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#notacceptable" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
NotAcceptable
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#unsupportedmediatype" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
UnsupportedMediaType
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#throttled" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Throttled
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#validationerror" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ValidationError
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#generic-error-views" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Generic Error Views
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Generic Error Views">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#rest_frameworkexceptionsserver_error" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
rest_framework.exceptions.server_error
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#rest_frameworkexceptionsbad_request" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
rest_framework.exceptions.bad_request
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third party packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Third party packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-standardized-errors" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DRF Standardized Errors
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2733,8 +3223,8 @@ def custom_exception_handler(exc, context):
|
|||
</code></pre></div>
|
||||
<p>Note that the exception handler will only be called for responses generated by raised exceptions. It will not be used for any responses returned directly by the view, such as the <code>HTTP_400_BAD_REQUEST</code> responses that are returned by the generic views when serializer validation fails.</p>
|
||||
<hr />
|
||||
<h1 id="api-reference">API Reference<a class="headerlink" href="#api-reference" title="Permanent link">¶</a></h1>
|
||||
<h2 id="apiexception">APIException<a class="headerlink" href="#apiexception" title="Permanent link">¶</a></h2>
|
||||
<h2 id="api-reference">API Reference<a class="headerlink" href="#api-reference" title="Permanent link">¶</a></h2>
|
||||
<h3 id="apiexception">APIException<a class="headerlink" href="#apiexception" title="Permanent link">¶</a></h3>
|
||||
<p><strong>Signature:</strong> <code>APIException()</code></p>
|
||||
<p>The <strong>base class</strong> for all exceptions raised inside an <code>APIView</code> class or <code>@api_view</code>.</p>
|
||||
<p>To provide a custom exception, subclass <code>APIException</code> and set the <code>.status_code</code>, <code>.default_detail</code>, and <code>.default_code</code> attributes on the class.</p>
|
||||
|
|
@ -2773,43 +3263,43 @@ dictionary of items:</p>
|
|||
>>> print(exc.get_full_details())
|
||||
{"name":{"message":"This field is required.","code":"required"},"age":{"message":"A valid integer is required.","code":"invalid"}}
|
||||
</code></pre></div>
|
||||
<h2 id="parseerror">ParseError<a class="headerlink" href="#parseerror" title="Permanent link">¶</a></h2>
|
||||
<h3 id="parseerror">ParseError<a class="headerlink" href="#parseerror" title="Permanent link">¶</a></h3>
|
||||
<p><strong>Signature:</strong> <code>ParseError(detail=None, code=None)</code></p>
|
||||
<p>Raised if the request contains malformed data when accessing <code>request.data</code>.</p>
|
||||
<p>By default this exception results in a response with the HTTP status code "400 Bad Request".</p>
|
||||
<h2 id="authenticationfailed">AuthenticationFailed<a class="headerlink" href="#authenticationfailed" title="Permanent link">¶</a></h2>
|
||||
<h3 id="authenticationfailed">AuthenticationFailed<a class="headerlink" href="#authenticationfailed" title="Permanent link">¶</a></h3>
|
||||
<p><strong>Signature:</strong> <code>AuthenticationFailed(detail=None, code=None)</code></p>
|
||||
<p>Raised when an incoming request includes incorrect authentication.</p>
|
||||
<p>By default this exception results in a response with the HTTP status code "401 Unauthenticated", but it may also result in a "403 Forbidden" response, depending on the authentication scheme in use. See the <a href="../authentication/">authentication documentation</a> for more details.</p>
|
||||
<h2 id="notauthenticated">NotAuthenticated<a class="headerlink" href="#notauthenticated" title="Permanent link">¶</a></h2>
|
||||
<h3 id="notauthenticated">NotAuthenticated<a class="headerlink" href="#notauthenticated" title="Permanent link">¶</a></h3>
|
||||
<p><strong>Signature:</strong> <code>NotAuthenticated(detail=None, code=None)</code></p>
|
||||
<p>Raised when an unauthenticated request fails the permission checks.</p>
|
||||
<p>By default this exception results in a response with the HTTP status code "401 Unauthenticated", but it may also result in a "403 Forbidden" response, depending on the authentication scheme in use. See the <a href="../authentication/">authentication documentation</a> for more details.</p>
|
||||
<h2 id="permissiondenied">PermissionDenied<a class="headerlink" href="#permissiondenied" title="Permanent link">¶</a></h2>
|
||||
<h3 id="permissiondenied">PermissionDenied<a class="headerlink" href="#permissiondenied" title="Permanent link">¶</a></h3>
|
||||
<p><strong>Signature:</strong> <code>PermissionDenied(detail=None, code=None)</code></p>
|
||||
<p>Raised when an authenticated request fails the permission checks.</p>
|
||||
<p>By default this exception results in a response with the HTTP status code "403 Forbidden".</p>
|
||||
<h2 id="notfound">NotFound<a class="headerlink" href="#notfound" title="Permanent link">¶</a></h2>
|
||||
<h3 id="notfound">NotFound<a class="headerlink" href="#notfound" title="Permanent link">¶</a></h3>
|
||||
<p><strong>Signature:</strong> <code>NotFound(detail=None, code=None)</code></p>
|
||||
<p>Raised when a resource does not exist at the given URL. This exception is equivalent to the standard <code>Http404</code> Django exception.</p>
|
||||
<p>By default this exception results in a response with the HTTP status code "404 Not Found".</p>
|
||||
<h2 id="methodnotallowed">MethodNotAllowed<a class="headerlink" href="#methodnotallowed" title="Permanent link">¶</a></h2>
|
||||
<h3 id="methodnotallowed">MethodNotAllowed<a class="headerlink" href="#methodnotallowed" title="Permanent link">¶</a></h3>
|
||||
<p><strong>Signature:</strong> <code>MethodNotAllowed(method, detail=None, code=None)</code></p>
|
||||
<p>Raised when an incoming request occurs that does not map to a handler method on the view.</p>
|
||||
<p>By default this exception results in a response with the HTTP status code "405 Method Not Allowed".</p>
|
||||
<h2 id="notacceptable">NotAcceptable<a class="headerlink" href="#notacceptable" title="Permanent link">¶</a></h2>
|
||||
<h3 id="notacceptable">NotAcceptable<a class="headerlink" href="#notacceptable" title="Permanent link">¶</a></h3>
|
||||
<p><strong>Signature:</strong> <code>NotAcceptable(detail=None, code=None)</code></p>
|
||||
<p>Raised when an incoming request occurs with an <code>Accept</code> header that cannot be satisfied by any of the available renderers.</p>
|
||||
<p>By default this exception results in a response with the HTTP status code "406 Not Acceptable".</p>
|
||||
<h2 id="unsupportedmediatype">UnsupportedMediaType<a class="headerlink" href="#unsupportedmediatype" title="Permanent link">¶</a></h2>
|
||||
<h3 id="unsupportedmediatype">UnsupportedMediaType<a class="headerlink" href="#unsupportedmediatype" title="Permanent link">¶</a></h3>
|
||||
<p><strong>Signature:</strong> <code>UnsupportedMediaType(media_type, detail=None, code=None)</code></p>
|
||||
<p>Raised if there are no parsers that can handle the content type of the request data when accessing <code>request.data</code>.</p>
|
||||
<p>By default this exception results in a response with the HTTP status code "415 Unsupported Media Type".</p>
|
||||
<h2 id="throttled">Throttled<a class="headerlink" href="#throttled" title="Permanent link">¶</a></h2>
|
||||
<h3 id="throttled">Throttled<a class="headerlink" href="#throttled" title="Permanent link">¶</a></h3>
|
||||
<p><strong>Signature:</strong> <code>Throttled(wait=None, detail=None, code=None)</code></p>
|
||||
<p>Raised when an incoming request fails the throttling checks.</p>
|
||||
<p>By default this exception results in a response with the HTTP status code "429 Too Many Requests".</p>
|
||||
<h2 id="validationerror">ValidationError<a class="headerlink" href="#validationerror" title="Permanent link">¶</a></h2>
|
||||
<h3 id="validationerror">ValidationError<a class="headerlink" href="#validationerror" title="Permanent link">¶</a></h3>
|
||||
<p><strong>Signature:</strong> <code>ValidationError(detail=None, code=None)</code></p>
|
||||
<p>The <code>ValidationError</code> exception is slightly different from the other <code>APIException</code> classes:</p>
|
||||
<ul>
|
||||
|
|
@ -2822,24 +3312,24 @@ dictionary of items:</p>
|
|||
<p>The generic views use the <code>raise_exception=True</code> flag, which means that you can override the style of validation error responses globally in your API. To do so, use a custom exception handler, as described above.</p>
|
||||
<p>By default this exception results in a response with the HTTP status code "400 Bad Request".</p>
|
||||
<hr />
|
||||
<h1 id="generic-error-views">Generic Error Views<a class="headerlink" href="#generic-error-views" title="Permanent link">¶</a></h1>
|
||||
<h2 id="generic-error-views">Generic Error Views<a class="headerlink" href="#generic-error-views" title="Permanent link">¶</a></h2>
|
||||
<p>Django REST Framework provides two error views suitable for providing generic JSON <code>500</code> Server Error and
|
||||
<code>400</code> Bad Request responses. (Django's default error views provide HTML responses, which may not be appropriate for an
|
||||
API-only application.)</p>
|
||||
<p>Use these as per <a href="https://docs.djangoproject.com/en/stable/topics/http/views/#customizing-error-views">Django's Customizing error views documentation</a>.</p>
|
||||
<h2 id="rest_frameworkexceptionsserver_error"><code>rest_framework.exceptions.server_error</code><a class="headerlink" href="#rest_frameworkexceptionsserver_error" title="Permanent link">¶</a></h2>
|
||||
<h3 id="rest_frameworkexceptionsserver_error"><code>rest_framework.exceptions.server_error</code><a class="headerlink" href="#rest_frameworkexceptionsserver_error" title="Permanent link">¶</a></h3>
|
||||
<p>Returns a response with status code <code>500</code> and <code>application/json</code> content type.</p>
|
||||
<p>Set as <code>handler500</code>:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>handler500 = 'rest_framework.exceptions.server_error'
|
||||
</code></pre></div>
|
||||
<h2 id="rest_frameworkexceptionsbad_request"><code>rest_framework.exceptions.bad_request</code><a class="headerlink" href="#rest_frameworkexceptionsbad_request" title="Permanent link">¶</a></h2>
|
||||
<h3 id="rest_frameworkexceptionsbad_request"><code>rest_framework.exceptions.bad_request</code><a class="headerlink" href="#rest_frameworkexceptionsbad_request" title="Permanent link">¶</a></h3>
|
||||
<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>
|
||||
<div class="language-text highlight"><pre><span></span><code>handler400 = 'rest_framework.exceptions.bad_request'
|
||||
</code></pre></div>
|
||||
<h1 id="third-party-packages">Third party packages<a class="headerlink" href="#third-party-packages" title="Permanent link">¶</a></h1>
|
||||
<h2 id="third-party-packages">Third party packages<a class="headerlink" href="#third-party-packages" title="Permanent link">¶</a></h2>
|
||||
<p>The following third-party packages are also available.</p>
|
||||
<h2 id="drf-standardized-errors">DRF Standardized Errors<a class="headerlink" href="#drf-standardized-errors" title="Permanent link">¶</a></h2>
|
||||
<h3 id="drf-standardized-errors">DRF Standardized Errors<a class="headerlink" href="#drf-standardized-errors" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://github.com/ghazi-git/drf-standardized-errors">drf-standardized-errors</a> package provides an exception handler that generates the same format for all 4xx and 5xx responses. It is a drop-in replacement for the default exception handler and allows customizing the error response format without rewriting the whole exception handler. The standardized error response format is easier to document and easier to handle by API consumers.</p>
|
||||
|
||||
|
||||
|
|
@ -2903,7 +3393,7 @@ API-only application.)</p>
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -1265,6 +1263,234 @@
|
|||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#generic-filtering" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Generic Filtering
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Generic Filtering">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setting-filter-backends" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setting filter backends
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#filtering-and-object-lookups" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Filtering and object lookups
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#overriding-the-initial-queryset" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Overriding the initial queryset
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-guide" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Guide
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Guide">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#djangofilterbackend" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DjangoFilterBackend
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#searchfilter" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
SearchFilter
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#orderingfilter" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
OrderingFilter
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="OrderingFilter">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#specifying-which-fields-may-be-ordered-against" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Specifying which fields may be ordered against
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#specifying-a-default-ordering" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Specifying a default ordering
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-generic-filtering" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom generic filtering
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom generic filtering">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#customizing-the-interface" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Customizing the interface
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third party packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Third party packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-rest-framework-filters-package" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django REST framework filters package
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-rest-framework-full-word-search-filter" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django REST framework full word search filter
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-url-filter" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django URL Filter
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-url-filters" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
drf-url-filters
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -2612,6 +2838,293 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#filtering-against-the-current-user" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Filtering against the current user
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#filtering-against-the-url" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Filtering against the URL
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#filtering-against-query-parameters" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Filtering against query parameters
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#generic-filtering" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Generic Filtering
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Generic Filtering">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setting-filter-backends" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setting filter backends
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#filtering-and-object-lookups" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Filtering and object lookups
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#overriding-the-initial-queryset" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Overriding the initial queryset
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-guide" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Guide
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Guide">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#djangofilterbackend" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DjangoFilterBackend
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#searchfilter" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
SearchFilter
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#orderingfilter" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
OrderingFilter
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="OrderingFilter">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#specifying-which-fields-may-be-ordered-against" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Specifying which fields may be ordered against
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#specifying-a-default-ordering" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Specifying a default ordering
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-generic-filtering" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom generic filtering
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom generic filtering">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#customizing-the-interface" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Customizing the interface
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third party packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Third party packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-rest-framework-filters-package" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django REST framework filters package
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-rest-framework-full-word-search-filter" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django REST framework full word search filter
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-url-filter" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django URL Filter
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-url-filters" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
drf-url-filters
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2735,11 +3248,11 @@ class PurchaseList(generics.ListAPIView):
|
|||
return queryset
|
||||
</code></pre></div>
|
||||
<hr />
|
||||
<h1 id="generic-filtering">Generic Filtering<a class="headerlink" href="#generic-filtering" title="Permanent link">¶</a></h1>
|
||||
<h2 id="generic-filtering">Generic Filtering<a class="headerlink" href="#generic-filtering" title="Permanent link">¶</a></h2>
|
||||
<p>As well as being able to override the default queryset, REST framework also includes support for generic filtering backends that allow you to easily construct complex searches and filters.</p>
|
||||
<p>Generic filters can also present themselves as HTML controls in the browsable API and admin API.</p>
|
||||
<p><img alt="Filter Example" src="../../img/filter-controls.png" /></p>
|
||||
<h2 id="setting-filter-backends">Setting filter backends<a class="headerlink" href="#setting-filter-backends" title="Permanent link">¶</a></h2>
|
||||
<h3 id="setting-filter-backends">Setting filter backends<a class="headerlink" href="#setting-filter-backends" title="Permanent link">¶</a></h3>
|
||||
<p>The default filter backends may be set globally, using the <code>DEFAULT_FILTER_BACKENDS</code> setting. For example.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>REST_FRAMEWORK = {
|
||||
'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend']
|
||||
|
|
@ -2757,12 +3270,12 @@ class UserListView(generics.ListAPIView):
|
|||
serializer_class = UserSerializer
|
||||
filter_backends = [django_filters.rest_framework.DjangoFilterBackend]
|
||||
</code></pre></div>
|
||||
<h2 id="filtering-and-object-lookups">Filtering and object lookups<a class="headerlink" href="#filtering-and-object-lookups" title="Permanent link">¶</a></h2>
|
||||
<h3 id="filtering-and-object-lookups">Filtering and object lookups<a class="headerlink" href="#filtering-and-object-lookups" title="Permanent link">¶</a></h3>
|
||||
<p>Note that if a filter backend is configured for a view, then as well as being used to filter list views, it will also be used to filter the querysets used for returning a single object.</p>
|
||||
<p>For instance, given the previous example, and a product with an id of <code>4675</code>, the following URL would either return the corresponding object, or return a 404 response, depending on if the filtering conditions were met by the given product instance:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>http://example.com/api/products/4675/?category=clothing&max_price=10.00
|
||||
</code></pre></div>
|
||||
<h2 id="overriding-the-initial-queryset">Overriding the initial queryset<a class="headerlink" href="#overriding-the-initial-queryset" title="Permanent link">¶</a></h2>
|
||||
<h3 id="overriding-the-initial-queryset">Overriding the initial queryset<a class="headerlink" href="#overriding-the-initial-queryset" title="Permanent link">¶</a></h3>
|
||||
<p>Note that you can use both an overridden <code>.get_queryset()</code> and generic filtering together, and everything will work as expected. For example, if <code>Product</code> had a many-to-many relationship with <code>User</code>, named <code>purchase</code>, you might want to write a view like this:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class PurchasedProductsList(generics.ListAPIView):
|
||||
"""
|
||||
|
|
@ -2778,8 +3291,8 @@ class UserListView(generics.ListAPIView):
|
|||
return user.purchase_set.all()
|
||||
</code></pre></div>
|
||||
<hr />
|
||||
<h1 id="api-guide">API Guide<a class="headerlink" href="#api-guide" title="Permanent link">¶</a></h1>
|
||||
<h2 id="djangofilterbackend">DjangoFilterBackend<a class="headerlink" href="#djangofilterbackend" title="Permanent link">¶</a></h2>
|
||||
<h2 id="api-guide">API Guide<a class="headerlink" href="#api-guide" title="Permanent link">¶</a></h2>
|
||||
<h3 id="djangofilterbackend">DjangoFilterBackend<a class="headerlink" href="#djangofilterbackend" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://django-filter.readthedocs.io/en/latest/index.html"><code>django-filter</code></a> library includes a <code>DjangoFilterBackend</code> class which
|
||||
supports highly customizable field filtering for REST framework.</p>
|
||||
<p>To use <code>DjangoFilterBackend</code>, first install <code>django-filter</code>.</p>
|
||||
|
|
@ -2817,7 +3330,7 @@ class UserListView(generics.ListAPIView):
|
|||
<p>For more advanced filtering requirements you can specify a <code>FilterSet</code> class that should be used by the view.
|
||||
You can read more about <code>FilterSet</code>s in the <a href="https://django-filter.readthedocs.io/en/latest/index.html">django-filter documentation</a>.
|
||||
It's also recommended that you read the section on <a href="https://django-filter.readthedocs.io/en/latest/guide/rest_framework.html">DRF integration</a>.</p>
|
||||
<h2 id="searchfilter">SearchFilter<a class="headerlink" href="#searchfilter" title="Permanent link">¶</a></h2>
|
||||
<h3 id="searchfilter">SearchFilter<a class="headerlink" href="#searchfilter" title="Permanent link">¶</a></h3>
|
||||
<p>The <code>SearchFilter</code> class supports simple single query parameter based searching, and is based on the <a href="https://docs.djangoproject.com/en/stable/ref/contrib/admin/#django.contrib.admin.ModelAdmin.search_fields">Django admin's search functionality</a>.</p>
|
||||
<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>
|
||||
|
|
@ -2892,7 +3405,7 @@ class CustomSearchFilter(filters.SearchFilter):
|
|||
</code></pre></div>
|
||||
<p>For more details, see the <a href="https://docs.djangoproject.com/en/stable/ref/contrib/admin/#django.contrib.admin.ModelAdmin.search_fields">Django documentation</a>.</p>
|
||||
<hr />
|
||||
<h2 id="orderingfilter">OrderingFilter<a class="headerlink" href="#orderingfilter" title="Permanent link">¶</a></h2>
|
||||
<h3 id="orderingfilter">OrderingFilter<a class="headerlink" href="#orderingfilter" title="Permanent link">¶</a></h3>
|
||||
<p>The <code>OrderingFilter</code> class supports simple query parameter controlled ordering of results.</p>
|
||||
<p><img alt="Ordering Filter" src="../../img/ordering-filter.png" /></p>
|
||||
<p>By default, the query parameter is named <code>'ordering'</code>, but this may be overridden with the <code>ORDERING_PARAM</code> setting in the <code>REST_FRAMEWORK</code> configuration.</p>
|
||||
|
|
@ -2905,7 +3418,7 @@ class CustomSearchFilter(filters.SearchFilter):
|
|||
<p>Multiple orderings may also be specified:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>http://example.com/api/users?ordering=account,username
|
||||
</code></pre></div>
|
||||
<h3 id="specifying-which-fields-may-be-ordered-against">Specifying which fields may be ordered against<a class="headerlink" href="#specifying-which-fields-may-be-ordered-against" title="Permanent link">¶</a></h3>
|
||||
<h4 id="specifying-which-fields-may-be-ordered-against">Specifying which fields may be ordered against<a class="headerlink" href="#specifying-which-fields-may-be-ordered-against" title="Permanent link">¶</a></h4>
|
||||
<p>It's recommended that you explicitly specify which fields the API should allow in the ordering filter. You can do this by setting an <code>ordering_fields</code> attribute on the view, like so:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class UserListView(generics.ListAPIView):
|
||||
queryset = User.objects.all()
|
||||
|
|
@ -2922,7 +3435,7 @@ class CustomSearchFilter(filters.SearchFilter):
|
|||
filter_backends = [filters.OrderingFilter]
|
||||
ordering_fields = '__all__'
|
||||
</code></pre></div>
|
||||
<h3 id="specifying-a-default-ordering">Specifying a default ordering<a class="headerlink" href="#specifying-a-default-ordering" title="Permanent link">¶</a></h3>
|
||||
<h4 id="specifying-a-default-ordering">Specifying a default ordering<a class="headerlink" href="#specifying-a-default-ordering" title="Permanent link">¶</a></h4>
|
||||
<p>If an <code>ordering</code> attribute is set on the view, this will be used as the default ordering.</p>
|
||||
<p>Typically you'd instead control this by setting <code>order_by</code> on the initial queryset, but using the <code>ordering</code> parameter on the view allows you to specify the ordering in a way that it can then be passed automatically as context to a rendered template. This makes it possible to automatically render column headers differently if they are being used to order the results.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class UserListView(generics.ListAPIView):
|
||||
|
|
@ -2934,11 +3447,11 @@ class CustomSearchFilter(filters.SearchFilter):
|
|||
</code></pre></div>
|
||||
<p>The <code>ordering</code> attribute may be either a string or a list/tuple of strings.</p>
|
||||
<hr />
|
||||
<h1 id="custom-generic-filtering">Custom generic filtering<a class="headerlink" href="#custom-generic-filtering" title="Permanent link">¶</a></h1>
|
||||
<h2 id="custom-generic-filtering">Custom generic filtering<a class="headerlink" href="#custom-generic-filtering" title="Permanent link">¶</a></h2>
|
||||
<p>You can also provide your own generic filtering backend, or write an installable app for other developers to use.</p>
|
||||
<p>To do so override <code>BaseFilterBackend</code>, and override the <code>.filter_queryset(self, request, queryset, view)</code> method. The method should return a new, filtered queryset.</p>
|
||||
<p>As well as allowing clients to perform searches and filtering, generic filter backends can be useful for restricting which objects should be visible to any given request or user.</p>
|
||||
<h2 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h2>
|
||||
<h3 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h3>
|
||||
<p>For example, you might need to restrict users to only being able to see objects they created.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class IsOwnerFilterBackend(filters.BaseFilterBackend):
|
||||
"""
|
||||
|
|
@ -2948,19 +3461,19 @@ class CustomSearchFilter(filters.SearchFilter):
|
|||
return queryset.filter(owner=request.user)
|
||||
</code></pre></div>
|
||||
<p>We could achieve the same behavior by overriding <code>get_queryset()</code> on the views, but using a filter backend allows you to more easily add this restriction to multiple views, or to apply it across the entire API.</p>
|
||||
<h2 id="customizing-the-interface">Customizing the interface<a class="headerlink" href="#customizing-the-interface" title="Permanent link">¶</a></h2>
|
||||
<h3 id="customizing-the-interface">Customizing the interface<a class="headerlink" href="#customizing-the-interface" title="Permanent link">¶</a></h3>
|
||||
<p>Generic filters may also present an interface in the browsable API. To do so you should implement a <code>to_html()</code> method which returns a rendered HTML representation of the filter. This method should have the following signature:</p>
|
||||
<p><code>to_html(self, request, queryset, view)</code></p>
|
||||
<p>The method should return a rendered HTML string.</p>
|
||||
<h1 id="third-party-packages">Third party packages<a class="headerlink" href="#third-party-packages" title="Permanent link">¶</a></h1>
|
||||
<h2 id="third-party-packages">Third party packages<a class="headerlink" href="#third-party-packages" title="Permanent link">¶</a></h2>
|
||||
<p>The following third party packages provide additional filter implementations.</p>
|
||||
<h2 id="django-rest-framework-filters-package">Django REST framework filters package<a class="headerlink" href="#django-rest-framework-filters-package" title="Permanent link">¶</a></h2>
|
||||
<h3 id="django-rest-framework-filters-package">Django REST framework filters package<a class="headerlink" href="#django-rest-framework-filters-package" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://github.com/philipn/django-rest-framework-filters">django-rest-framework-filters package</a> works together with the <code>DjangoFilterBackend</code> class, and allows you to easily create filters across relationships, or create multiple filter lookup types for a given field.</p>
|
||||
<h2 id="django-rest-framework-full-word-search-filter">Django REST framework full word search filter<a class="headerlink" href="#django-rest-framework-full-word-search-filter" title="Permanent link">¶</a></h2>
|
||||
<h3 id="django-rest-framework-full-word-search-filter">Django REST framework full word search filter<a class="headerlink" href="#django-rest-framework-full-word-search-filter" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://github.com/trollknurr/django-rest-framework-word-search-filter">djangorestframework-word-filter</a> developed as alternative to <code>filters.SearchFilter</code> which will search full word in text, or exact match.</p>
|
||||
<h2 id="django-url-filter">Django URL Filter<a class="headerlink" href="#django-url-filter" title="Permanent link">¶</a></h2>
|
||||
<h3 id="django-url-filter">Django URL Filter<a class="headerlink" href="#django-url-filter" title="Permanent link">¶</a></h3>
|
||||
<p><a href="https://github.com/miki725/django-url-filter">django-url-filter</a> provides a safe way to filter data via human-friendly URLs. It works very similar to DRF serializers and fields in a sense that they can be nested except they are called filtersets and filters. That provides easy way to filter related data. Also this library is generic-purpose so it can be used to filter other sources of data and not only Django <code>QuerySet</code>s.</p>
|
||||
<h2 id="drf-url-filters">drf-url-filters<a class="headerlink" href="#drf-url-filters" title="Permanent link">¶</a></h2>
|
||||
<h3 id="drf-url-filters">drf-url-filters<a class="headerlink" href="#drf-url-filters" title="Permanent link">¶</a></h3>
|
||||
<p><a href="https://github.com/manjitkumar/drf-url-filters">drf-url-filter</a> is a simple Django app to apply filters on drf <code>ModelViewSet</code>'s <code>Queryset</code> in a clean, simple and configurable way. It also supports validations on incoming query params and their values. A beautiful python package <code>Voluptuous</code> is being used for validations on the incoming query parameters. The best part about voluptuous is you can define your own validations as per your query params requirements.</p>
|
||||
|
||||
|
||||
|
|
@ -3024,7 +3537,7 @@ class CustomSearchFilter(filters.SearchFilter):
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2629,6 +2627,82 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#format_suffix_patterns" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
format_suffix_patterns
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="format_suffix_patterns">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-with-i18n_patterns" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using with i18n_patterns
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#query-parameter-formats" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Query parameter formats
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#accept-headers-vs-format-suffixes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Accept headers vs. format suffixes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2817,7 +2891,7 @@ urlpatterns = i18n_patterns(
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -1366,6 +1364,62 @@
|
|||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-metadata-classes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom metadata classes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom metadata classes">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third party packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Third party packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-schema-adapter" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DRF-schema-adapter
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -2601,6 +2655,110 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setting-the-metadata-scheme" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setting the metadata scheme
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#creating-schema-endpoints" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Creating schema endpoints
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-metadata-classes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom metadata classes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom metadata classes">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third party packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Third party packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-schema-adapter" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DRF-schema-adapter
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2726,10 +2884,10 @@ def api_schema(self, request):
|
|||
</code></pre></div>
|
||||
<p>There are a couple of reasons that you might choose to take this approach, including that <code>OPTIONS</code> responses <a href="https://www.mnot.net/blog/2012/10/29/NO_OPTIONS">are not cacheable</a>.</p>
|
||||
<hr />
|
||||
<h1 id="custom-metadata-classes">Custom metadata classes<a class="headerlink" href="#custom-metadata-classes" title="Permanent link">¶</a></h1>
|
||||
<h2 id="custom-metadata-classes">Custom metadata classes<a class="headerlink" href="#custom-metadata-classes" title="Permanent link">¶</a></h2>
|
||||
<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="https://json-schema.org/">JSON schema</a>, or returning debug information to admin users.</p>
|
||||
<h2 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h2>
|
||||
<h3 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h3>
|
||||
<p>The following class could be used to limit the information that is returned to <code>OPTIONS</code> requests.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class MinimalMetadata(BaseMetadata):
|
||||
"""
|
||||
|
|
@ -2747,9 +2905,9 @@ def api_schema(self, request):
|
|||
'DEFAULT_METADATA_CLASS': 'myproject.apps.core.MinimalMetadata'
|
||||
}
|
||||
</code></pre></div>
|
||||
<h1 id="third-party-packages">Third party packages<a class="headerlink" href="#third-party-packages" title="Permanent link">¶</a></h1>
|
||||
<h2 id="third-party-packages">Third party packages<a class="headerlink" href="#third-party-packages" title="Permanent link">¶</a></h2>
|
||||
<p>The following third party packages provide additional metadata implementations.</p>
|
||||
<h2 id="drf-schema-adapter">DRF-schema-adapter<a class="headerlink" href="#drf-schema-adapter" title="Permanent link">¶</a></h2>
|
||||
<h3 id="drf-schema-adapter">DRF-schema-adapter<a class="headerlink" href="#drf-schema-adapter" title="Permanent link">¶</a></h3>
|
||||
<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>
|
||||
|
|
@ -2815,7 +2973,7 @@ If you wish to do so, it also provides an exporter that can export those schema
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -1282,6 +1280,285 @@
|
|||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-reference" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Reference
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Reference">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#pagenumberpagination" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
PageNumberPagination
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="PageNumberPagination">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setup" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setup
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#configuration" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Configuration
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#limitoffsetpagination" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
LimitOffsetPagination
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="LimitOffsetPagination">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setup_1" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setup
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#configuration_1" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Configuration
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#cursorpagination" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
CursorPagination
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="CursorPagination">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#details-and-limitations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Details and limitations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setup_2" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setup
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#configuration_2" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Configuration
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-pagination-styles" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom pagination styles
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom pagination styles">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-your-custom-pagination-class" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using your custom pagination class
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#html-pagination-controls" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
HTML pagination controls
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="HTML pagination controls">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#customizing-the-controls" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Customizing the controls
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Customizing the controls">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#low-level-api" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Low-level API
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third party packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Third party packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-extensions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DRF-extensions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-proxy-pagination" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
drf-proxy-pagination
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#link-header-pagination" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
link-header-pagination
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -2601,6 +2878,333 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setting-the-pagination-style" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setting the pagination style
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#modifying-the-pagination-style" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Modifying the pagination style
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-reference" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Reference
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Reference">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#pagenumberpagination" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
PageNumberPagination
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="PageNumberPagination">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setup" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setup
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#configuration" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Configuration
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#limitoffsetpagination" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
LimitOffsetPagination
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="LimitOffsetPagination">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setup_1" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setup
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#configuration_1" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Configuration
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#cursorpagination" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
CursorPagination
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="CursorPagination">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#details-and-limitations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Details and limitations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setup_2" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setup
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#configuration_2" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Configuration
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-pagination-styles" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom pagination styles
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom pagination styles">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-your-custom-pagination-class" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using your custom pagination class
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#html-pagination-controls" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
HTML pagination controls
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="HTML pagination controls">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#customizing-the-controls" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Customizing the controls
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Customizing the controls">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#low-level-api" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Low-level API
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third party packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Third party packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-extensions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DRF-extensions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-proxy-pagination" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
drf-proxy-pagination
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#link-header-pagination" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
link-header-pagination
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2709,8 +3313,8 @@ class StandardResultsSetPagination(PageNumberPagination):
|
|||
}
|
||||
</code></pre></div>
|
||||
<hr />
|
||||
<h1 id="api-reference">API Reference<a class="headerlink" href="#api-reference" title="Permanent link">¶</a></h1>
|
||||
<h2 id="pagenumberpagination">PageNumberPagination<a class="headerlink" href="#pagenumberpagination" title="Permanent link">¶</a></h2>
|
||||
<h2 id="api-reference">API Reference<a class="headerlink" href="#api-reference" title="Permanent link">¶</a></h2>
|
||||
<h3 id="pagenumberpagination">PageNumberPagination<a class="headerlink" href="#pagenumberpagination" title="Permanent link">¶</a></h3>
|
||||
<p>This pagination style accepts a single number page number in the request query parameters.</p>
|
||||
<p><strong>Request</strong>:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>GET https://api.example.org/accounts/?page=4
|
||||
|
|
@ -2756,7 +3360,7 @@ class CustomPagination(PageNumberPagination):
|
|||
<li><code>template</code> - The name of a template to use when rendering pagination controls in the browsable API. May be overridden to modify the rendering style, or set to <code>None</code> to disable HTML pagination controls completely. Defaults to <code>"rest_framework/pagination/numbers.html"</code>.</li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h2 id="limitoffsetpagination">LimitOffsetPagination<a class="headerlink" href="#limitoffsetpagination" title="Permanent link">¶</a></h2>
|
||||
<h3 id="limitoffsetpagination">LimitOffsetPagination<a class="headerlink" href="#limitoffsetpagination" title="Permanent link">¶</a></h3>
|
||||
<p>This pagination style mirrors the syntax used when looking up multiple database records. The client includes both a "limit" and an
|
||||
"offset" query parameter. The limit indicates the maximum number of items to return, and is equivalent to the <code>page_size</code> in other styles. The offset indicates the starting position of the query in relation to the complete set of unpaginated items.</p>
|
||||
<p><strong>Request</strong>:</p>
|
||||
|
|
@ -2792,7 +3396,7 @@ class CustomPagination(PageNumberPagination):
|
|||
<li><code>template</code> - The name of a template to use when rendering pagination controls in the browsable API. May be overridden to modify the rendering style, or set to <code>None</code> to disable HTML pagination controls completely. Defaults to <code>"rest_framework/pagination/numbers.html"</code>.</li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h2 id="cursorpagination">CursorPagination<a class="headerlink" href="#cursorpagination" title="Permanent link">¶</a></h2>
|
||||
<h3 id="cursorpagination">CursorPagination<a class="headerlink" href="#cursorpagination" title="Permanent link">¶</a></h3>
|
||||
<p>The cursor-based pagination presents an opaque "cursor" indicator that the client may use to page through the result set. This pagination style only presents forward and reverse controls, and does not allow the client to navigate to arbitrary positions.</p>
|
||||
<p>Cursor based pagination requires that there is a unique, unchanging ordering of items in the result set. This ordering might typically be a creation timestamp on the records, as this presents a consistent ordering to paginate against.</p>
|
||||
<p>Cursor based pagination is more complex than other schemes. It also requires that the result set presents a fixed ordering, and does not allow the client to arbitrarily index into the result set. However it does provide the following benefits:</p>
|
||||
|
|
@ -2834,14 +3438,14 @@ class CustomPagination(PageNumberPagination):
|
|||
<li><code>template</code> = The name of a template to use when rendering pagination controls in the browsable API. May be overridden to modify the rendering style, or set to <code>None</code> to disable HTML pagination controls completely. Defaults to <code>"rest_framework/pagination/previous_and_next.html"</code>.</li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h1 id="custom-pagination-styles">Custom pagination styles<a class="headerlink" href="#custom-pagination-styles" title="Permanent link">¶</a></h1>
|
||||
<h2 id="custom-pagination-styles">Custom pagination styles<a class="headerlink" href="#custom-pagination-styles" title="Permanent link">¶</a></h2>
|
||||
<p>To create a custom pagination serializer class, you should inherit the subclass <code>pagination.BasePagination</code>, override the <code>paginate_queryset(self, queryset, request, view=None)</code>, and <code>get_paginated_response(self, data)</code> methods:</p>
|
||||
<ul>
|
||||
<li>The <code>paginate_queryset</code> method is passed to the initial queryset and should return an iterable object. That object contains only the data in the requested page.</li>
|
||||
<li>The <code>get_paginated_response</code> method is passed to the serialized page data and should return a <code>Response</code> instance.</li>
|
||||
</ul>
|
||||
<p>Note that the <code>paginate_queryset</code> method may set state on the pagination instance, that may later be used by the <code>get_paginated_response</code> method.</p>
|
||||
<h2 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h2>
|
||||
<h3 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h3>
|
||||
<p>Suppose we want to replace the default pagination output style with a modified format that includes the next and previous links under in a nested 'links' key. We could specify a custom pagination class like so:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class CustomPagination(pagination.PageNumberPagination):
|
||||
def get_paginated_response(self, data):
|
||||
|
|
@ -2861,7 +3465,7 @@ class CustomPagination(PageNumberPagination):
|
|||
}
|
||||
</code></pre></div>
|
||||
<p>Note that if you care about how the ordering of keys is displayed in responses in the browsable API you might choose to use an <code>OrderedDict</code> when constructing the body of paginated responses, but this is optional.</p>
|
||||
<h2 id="using-your-custom-pagination-class">Using your custom pagination class<a class="headerlink" href="#using-your-custom-pagination-class" title="Permanent link">¶</a></h2>
|
||||
<h3 id="using-your-custom-pagination-class">Using your custom pagination class<a class="headerlink" href="#using-your-custom-pagination-class" title="Permanent link">¶</a></h3>
|
||||
<p>To have your custom pagination class be used by default, use the <code>DEFAULT_PAGINATION_CLASS</code> setting:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>REST_FRAMEWORK = {
|
||||
'DEFAULT_PAGINATION_CLASS': 'my_project.apps.core.pagination.LinkHeaderPagination',
|
||||
|
|
@ -2872,9 +3476,9 @@ class CustomPagination(PageNumberPagination):
|
|||
<p><img alt="Link Header" src="../../img/link-header-pagination.png" /></p>
|
||||
<p><em>A custom pagination style, using the 'Link' header</em></p>
|
||||
<hr />
|
||||
<h1 id="html-pagination-controls">HTML pagination controls<a class="headerlink" href="#html-pagination-controls" title="Permanent link">¶</a></h1>
|
||||
<h2 id="html-pagination-controls">HTML pagination controls<a class="headerlink" href="#html-pagination-controls" title="Permanent link">¶</a></h2>
|
||||
<p>By default using the pagination classes will cause HTML pagination controls to be displayed in the browsable API. There are two built-in display styles. The <code>PageNumberPagination</code> and <code>LimitOffsetPagination</code> classes display a list of page numbers with previous and next controls. The <code>CursorPagination</code> class displays a simpler style that only displays a previous and next control.</p>
|
||||
<h2 id="customizing-the-controls">Customizing the controls<a class="headerlink" href="#customizing-the-controls" title="Permanent link">¶</a></h2>
|
||||
<h3 id="customizing-the-controls">Customizing the controls<a class="headerlink" href="#customizing-the-controls" title="Permanent link">¶</a></h3>
|
||||
<p>You can override the templates that render the HTML pagination controls. The two built-in styles are:</p>
|
||||
<ul>
|
||||
<li><code>rest_framework/pagination/numbers.html</code></li>
|
||||
|
|
@ -2886,13 +3490,13 @@ class CustomPagination(PageNumberPagination):
|
|||
<p>The low-level API for determining if a pagination class should display the controls or not is exposed as a <code>display_page_controls</code> attribute on the pagination instance. Custom pagination classes should be set to <code>True</code> in the <code>paginate_queryset</code> method if they require the HTML pagination controls to be displayed.</p>
|
||||
<p>The <code>.to_html()</code> and <code>.get_html_context()</code> methods may also be overridden in a custom pagination class in order to further customize how the controls are rendered.</p>
|
||||
<hr />
|
||||
<h1 id="third-party-packages">Third party packages<a class="headerlink" href="#third-party-packages" title="Permanent link">¶</a></h1>
|
||||
<h2 id="third-party-packages">Third party packages<a class="headerlink" href="#third-party-packages" title="Permanent link">¶</a></h2>
|
||||
<p>The following third party packages are also available.</p>
|
||||
<h2 id="drf-extensions">DRF-extensions<a class="headerlink" href="#drf-extensions" title="Permanent link">¶</a></h2>
|
||||
<h3 id="drf-extensions">DRF-extensions<a class="headerlink" href="#drf-extensions" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://chibisov.github.io/drf-extensions/docs/"><code>DRF-extensions</code> package</a> includes a <a href="https://chibisov.github.io/drf-extensions/docs/#paginatebymaxmixin"><code>PaginateByMaxMixin</code> mixin class</a> that allows your API clients to specify <code>?page_size=max</code> to obtain the maximum allowed page size.</p>
|
||||
<h2 id="drf-proxy-pagination">drf-proxy-pagination<a class="headerlink" href="#drf-proxy-pagination" title="Permanent link">¶</a></h2>
|
||||
<h3 id="drf-proxy-pagination">drf-proxy-pagination<a class="headerlink" href="#drf-proxy-pagination" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://github.com/tuffnatty/drf-proxy-pagination"><code>drf-proxy-pagination</code> package</a> includes a <code>ProxyPagination</code> class which allows to choose pagination class with a query parameter.</p>
|
||||
<h2 id="link-header-pagination">link-header-pagination<a class="headerlink" href="#link-header-pagination" title="Permanent link">¶</a></h2>
|
||||
<h3 id="link-header-pagination">link-header-pagination<a class="headerlink" href="#link-header-pagination" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://github.com/tbeadle/django-rest-framework-link-header-pagination"><code>django-rest-framework-link-header-pagination</code> package</a> includes a <code>LinkHeaderPagination</code> class which provides pagination via an HTTP <code>Link</code> header as described in <a href="https://docs.github.com/en/rest/guides/traversing-with-pagination">GitHub REST API documentation</a>.</p>
|
||||
|
||||
|
||||
|
|
@ -2956,7 +3560,7 @@ class CustomPagination(PageNumberPagination):
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -974,6 +972,240 @@
|
|||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-reference" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Reference
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Reference">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#jsonparser" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
JSONParser
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#formparser" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
FormParser
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#multipartparser" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
MultiPartParser
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#fileuploadparser" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
FileUploadParser
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="FileUploadParser">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#basic-usage-example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Basic usage example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-parsers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom parsers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom parsers">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#stream" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
stream
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#media_type" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
media_type
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#parser_context" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
parser_context
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third party packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Third party packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#yaml" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
YAML
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="YAML">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#installation-configuration" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Installation & configuration
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#xml" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
XML
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="XML">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#installation-configuration_1" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Installation & configuration
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#messagepack" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
MessagePack
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#camelcase-json" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
CamelCase JSON
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -2601,6 +2833,288 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#how-the-parser-is-determined" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
How the parser is determined
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setting-the-parsers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setting the parsers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-reference" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Reference
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Reference">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#jsonparser" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
JSONParser
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#formparser" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
FormParser
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#multipartparser" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
MultiPartParser
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#fileuploadparser" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
FileUploadParser
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="FileUploadParser">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#basic-usage-example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Basic usage example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-parsers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom parsers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom parsers">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#stream" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
stream
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#media_type" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
media_type
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#parser_context" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
parser_context
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third party packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Third party packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#yaml" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
YAML
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="YAML">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#installation-configuration" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Installation & configuration
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#xml" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
XML
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="XML">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#installation-configuration_1" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Installation & configuration
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#messagepack" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
MessagePack
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#camelcase-json" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
CamelCase JSON
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2715,30 +3229,32 @@ def example_view(request, format=None):
|
|||
return Response({'received data': request.data})
|
||||
</code></pre></div>
|
||||
<hr />
|
||||
<h1 id="api-reference">API Reference<a class="headerlink" href="#api-reference" title="Permanent link">¶</a></h1>
|
||||
<h2 id="jsonparser">JSONParser<a class="headerlink" href="#jsonparser" title="Permanent link">¶</a></h2>
|
||||
<h2 id="api-reference">API Reference<a class="headerlink" href="#api-reference" title="Permanent link">¶</a></h2>
|
||||
<h3 id="jsonparser">JSONParser<a class="headerlink" href="#jsonparser" title="Permanent link">¶</a></h3>
|
||||
<p>Parses <code>JSON</code> request content. <code>request.data</code> will be populated with a dictionary of data.</p>
|
||||
<p><strong>.media_type</strong>: <code>application/json</code></p>
|
||||
<h2 id="formparser">FormParser<a class="headerlink" href="#formparser" title="Permanent link">¶</a></h2>
|
||||
<h3 id="formparser">FormParser<a class="headerlink" href="#formparser" title="Permanent link">¶</a></h3>
|
||||
<p>Parses HTML form content. <code>request.data</code> will be populated with a <code>QueryDict</code> of data.</p>
|
||||
<p>You will typically want to use both <code>FormParser</code> and <code>MultiPartParser</code> together in order to fully support HTML form data.</p>
|
||||
<p><strong>.media_type</strong>: <code>application/x-www-form-urlencoded</code></p>
|
||||
<h2 id="multipartparser">MultiPartParser<a class="headerlink" href="#multipartparser" title="Permanent link">¶</a></h2>
|
||||
<h3 id="multipartparser">MultiPartParser<a class="headerlink" href="#multipartparser" title="Permanent link">¶</a></h3>
|
||||
<p>Parses multipart HTML form content, which supports file uploads. <code>request.data</code> and <code>request.FILES</code> will be populated with a <code>QueryDict</code> and <code>MultiValueDict</code> respectively.</p>
|
||||
<p>You will typically want to use both <code>FormParser</code> and <code>MultiPartParser</code> together in order to fully support HTML form data.</p>
|
||||
<p><strong>.media_type</strong>: <code>multipart/form-data</code></p>
|
||||
<h2 id="fileuploadparser">FileUploadParser<a class="headerlink" href="#fileuploadparser" title="Permanent link">¶</a></h2>
|
||||
<h3 id="fileuploadparser">FileUploadParser<a class="headerlink" href="#fileuploadparser" title="Permanent link">¶</a></h3>
|
||||
<p>Parses raw file upload content. The <code>request.data</code> property will be a dictionary with a single key <code>'file'</code> containing the uploaded file.</p>
|
||||
<p>If the view used with <code>FileUploadParser</code> is called with a <code>filename</code> URL keyword argument, then that argument will be used as the filename.</p>
|
||||
<p>If it is called without a <code>filename</code> URL keyword argument, then the client must set the filename in the <code>Content-Disposition</code> HTTP header. For example <code>Content-Disposition: attachment; filename=upload.jpg</code>.</p>
|
||||
<p><strong>.media_type</strong>: <code>*/*</code></p>
|
||||
<h5 id="notes">Notes:<a class="headerlink" href="#notes" title="Permanent link">¶</a></h5>
|
||||
<div class="admonition note">
|
||||
<p class="admonition-title">Note</p>
|
||||
<ul>
|
||||
<li>The <code>FileUploadParser</code> is for usage with native clients that can upload the file as a raw data request. For web-based uploads, or for native clients with multipart upload support, you should use the <code>MultiPartParser</code> instead.</li>
|
||||
<li>Since this parser's <code>media_type</code> matches any content type, <code>FileUploadParser</code> should generally be the only parser set on an API view.</li>
|
||||
<li><code>FileUploadParser</code> respects Django's standard <code>FILE_UPLOAD_HANDLERS</code> setting, and the <code>request.upload_handlers</code> attribute. See the <a href="https://docs.djangoproject.com/en/stable/topics/http/file-uploads/#upload-handlers">Django documentation</a> for more details.</li>
|
||||
</ul>
|
||||
<h5 id="basic-usage-example">Basic usage example:<a class="headerlink" href="#basic-usage-example" title="Permanent link">¶</a></h5>
|
||||
</div>
|
||||
<h4 id="basic-usage-example">Basic usage example<a class="headerlink" href="#basic-usage-example" title="Permanent link">¶</a></h4>
|
||||
<div class="language-text highlight"><pre><span></span><code># views.py
|
||||
class FileUploadView(views.APIView):
|
||||
parser_classes = [FileUploadParser]
|
||||
|
|
@ -2757,7 +3273,7 @@ urlpatterns = [
|
|||
]
|
||||
</code></pre></div>
|
||||
<hr />
|
||||
<h1 id="custom-parsers">Custom parsers<a class="headerlink" href="#custom-parsers" title="Permanent link">¶</a></h1>
|
||||
<h2 id="custom-parsers">Custom parsers<a class="headerlink" href="#custom-parsers" title="Permanent link">¶</a></h2>
|
||||
<p>To implement a custom parser, you should override <code>BaseParser</code>, set the <code>.media_type</code> property, and implement the <code>.parse(self, stream, media_type, parser_context)</code> method.</p>
|
||||
<p>The method should return the data that will be used to populate the <code>request.data</code> property.</p>
|
||||
<p>The arguments passed to <code>.parse()</code> are:</p>
|
||||
|
|
@ -2769,7 +3285,7 @@ urlpatterns = [
|
|||
<h3 id="parser_context">parser_context<a class="headerlink" href="#parser_context" title="Permanent link">¶</a></h3>
|
||||
<p>Optional. If supplied, this argument will be a dictionary containing any additional context that may be required to parse the request content.</p>
|
||||
<p>By default this will include the following keys: <code>view</code>, <code>request</code>, <code>args</code>, <code>kwargs</code>.</p>
|
||||
<h2 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h2>
|
||||
<h3 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h3>
|
||||
<p>The following is an example plaintext parser that will populate the <code>request.data</code> property with a string representing the body of the request.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class PlainTextParser(BaseParser):
|
||||
"""
|
||||
|
|
@ -2784,9 +3300,9 @@ urlpatterns = [
|
|||
return stream.read()
|
||||
</code></pre></div>
|
||||
<hr />
|
||||
<h1 id="third-party-packages">Third party packages<a class="headerlink" href="#third-party-packages" title="Permanent link">¶</a></h1>
|
||||
<h2 id="third-party-packages">Third party packages<a class="headerlink" href="#third-party-packages" title="Permanent link">¶</a></h2>
|
||||
<p>The following third party packages are also available.</p>
|
||||
<h2 id="yaml">YAML<a class="headerlink" href="#yaml" title="Permanent link">¶</a></h2>
|
||||
<h3 id="yaml">YAML<a class="headerlink" href="#yaml" title="Permanent link">¶</a></h3>
|
||||
<p><a href="https://jpadilla.github.io/django-rest-framework-yaml/">REST framework YAML</a> provides <a href="http://www.yaml.org/">YAML</a> parsing and rendering support. It was previously included directly in the REST framework package, and is now instead supported as a third-party package.</p>
|
||||
<h4 id="installation-configuration">Installation & configuration<a class="headerlink" href="#installation-configuration" title="Permanent link">¶</a></h4>
|
||||
<p>Install using pip.</p>
|
||||
|
|
@ -2802,7 +3318,7 @@ urlpatterns = [
|
|||
],
|
||||
}
|
||||
</code></pre></div>
|
||||
<h2 id="xml">XML<a class="headerlink" href="#xml" title="Permanent link">¶</a></h2>
|
||||
<h3 id="xml">XML<a class="headerlink" href="#xml" title="Permanent link">¶</a></h3>
|
||||
<p><a href="https://jpadilla.github.io/django-rest-framework-xml/">REST Framework XML</a> provides a simple informal XML format. It was previously included directly in the REST framework package, and is now instead supported as a third-party package.</p>
|
||||
<h4 id="installation-configuration_1">Installation & configuration<a class="headerlink" href="#installation-configuration_1" title="Permanent link">¶</a></h4>
|
||||
<p>Install using pip.</p>
|
||||
|
|
@ -2818,9 +3334,9 @@ urlpatterns = [
|
|||
],
|
||||
}
|
||||
</code></pre></div>
|
||||
<h2 id="messagepack">MessagePack<a class="headerlink" href="#messagepack" title="Permanent link">¶</a></h2>
|
||||
<h3 id="messagepack">MessagePack<a class="headerlink" href="#messagepack" title="Permanent link">¶</a></h3>
|
||||
<p><a href="https://github.com/juanriaza/django-rest-framework-msgpack">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="camelcase-json">CamelCase JSON<a class="headerlink" href="#camelcase-json" title="Permanent link">¶</a></h2>
|
||||
<h3 id="camelcase-json">CamelCase JSON<a class="headerlink" href="#camelcase-json" title="Permanent link">¶</a></h3>
|
||||
<p><a href="https://github.com/vbabiy/djangorestframework-camel-case">djangorestframework-camel-case</a> provides camel case JSON renderers and parsers for REST framework. This allows serializers to use Python-style underscored field names, but be exposed in the API as Javascript-style camel case field names. It is maintained by <a href="https://github.com/vbabiy">Vitaly Babiy</a>.</p>
|
||||
|
||||
|
||||
|
|
@ -2884,7 +3400,7 @@ urlpatterns = [
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -1198,6 +1196,266 @@
|
|||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-reference" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Reference
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Reference">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#allowany" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
AllowAny
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#isauthenticated" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
IsAuthenticated
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#isadminuser" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
IsAdminUser
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#isauthenticatedorreadonly" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
IsAuthenticatedOrReadOnly
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#djangomodelpermissions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DjangoModelPermissions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#djangomodelpermissionsoranonreadonly" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DjangoModelPermissionsOrAnonReadOnly
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#djangoobjectpermissions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DjangoObjectPermissions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-permissions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom permissions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom permissions">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#examples" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Examples
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#overview-of-access-restriction-methods" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Overview of access restriction methods
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third party packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Third party packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-access-policy" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DRF - Access Policy
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#composed-permissions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Composed Permissions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#rest-condition" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
REST Condition
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#dry-rest-permissions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DRY Rest Permissions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-rest-framework-roles" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django Rest Framework Roles
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#rest-framework-roles" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Rest Framework Roles
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-rest-framework-api-key" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django REST Framework API Key
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-rest-framework-role-filters" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django Rest Framework Role Filters
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-rest-framework-psq" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django Rest Framework PSQ
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#axioms-drf-py" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Axioms DRF PY
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -2629,6 +2887,342 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#how-permissions-are-determined" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
How permissions are determined
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#object-level-permissions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Object level permissions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Object level permissions">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#limitations-of-object-level-permissions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Limitations of object level permissions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setting-the-permission-policy" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setting the permission policy
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-reference" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Reference
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Reference">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#allowany" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
AllowAny
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#isauthenticated" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
IsAuthenticated
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#isadminuser" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
IsAdminUser
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#isauthenticatedorreadonly" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
IsAuthenticatedOrReadOnly
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#djangomodelpermissions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DjangoModelPermissions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#djangomodelpermissionsoranonreadonly" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DjangoModelPermissionsOrAnonReadOnly
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#djangoobjectpermissions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DjangoObjectPermissions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-permissions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom permissions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom permissions">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#examples" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Examples
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#overview-of-access-restriction-methods" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Overview of access restriction methods
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third party packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Third party packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-access-policy" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DRF - Access Policy
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#composed-permissions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Composed Permissions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#rest-condition" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
REST Condition
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#dry-rest-permissions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DRY Rest Permissions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-rest-framework-roles" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django Rest Framework Roles
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#rest-framework-roles" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Rest Framework Roles
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-rest-framework-api-key" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django REST Framework API Key
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-rest-framework-role-filters" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django Rest Framework Role Filters
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-rest-framework-psq" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django Rest Framework PSQ
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#axioms-drf-py" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Axioms DRF PY
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2805,20 +3399,20 @@ class ExampleView(APIView):
|
|||
<p>Composition of permissions supports the <code>&</code> (and), <code>|</code> (or) and <code>~</code> (not) operators, and also allows the use of brackets <code>(</code> <code>)</code> to group expressions.</p>
|
||||
<p>Operators follow the same precedence and associativity rules as standard logical operators (<code>~</code> highest, then <code>&</code>, then <code>|</code>).</p>
|
||||
</div>
|
||||
<h1 id="api-reference">API Reference<a class="headerlink" href="#api-reference" title="Permanent link">¶</a></h1>
|
||||
<h2 id="allowany">AllowAny<a class="headerlink" href="#allowany" title="Permanent link">¶</a></h2>
|
||||
<h2 id="api-reference">API Reference<a class="headerlink" href="#api-reference" title="Permanent link">¶</a></h2>
|
||||
<h3 id="allowany">AllowAny<a class="headerlink" href="#allowany" title="Permanent link">¶</a></h3>
|
||||
<p>The <code>AllowAny</code> permission class will allow unrestricted access, <strong>regardless of if the request was authenticated or unauthenticated</strong>.</p>
|
||||
<p>This permission is not strictly required, since you can achieve the same result by using an empty list or tuple for the permissions setting, but you may find it useful to specify this class because it makes the intention explicit.</p>
|
||||
<h2 id="isauthenticated">IsAuthenticated<a class="headerlink" href="#isauthenticated" title="Permanent link">¶</a></h2>
|
||||
<h3 id="isauthenticated">IsAuthenticated<a class="headerlink" href="#isauthenticated" title="Permanent link">¶</a></h3>
|
||||
<p>The <code>IsAuthenticated</code> permission class will deny permission to any unauthenticated user, and allow permission otherwise.</p>
|
||||
<p>This permission is suitable if you want your API to only be accessible to registered users.</p>
|
||||
<h2 id="isadminuser">IsAdminUser<a class="headerlink" href="#isadminuser" title="Permanent link">¶</a></h2>
|
||||
<h3 id="isadminuser">IsAdminUser<a class="headerlink" href="#isadminuser" title="Permanent link">¶</a></h3>
|
||||
<p>The <code>IsAdminUser</code> permission class will deny permission to any user, unless <code>user.is_staff</code> is <code>True</code> in which case permission will be allowed.</p>
|
||||
<p>This permission is suitable if you want your API to only be accessible to a subset of trusted administrators.</p>
|
||||
<h2 id="isauthenticatedorreadonly">IsAuthenticatedOrReadOnly<a class="headerlink" href="#isauthenticatedorreadonly" title="Permanent link">¶</a></h2>
|
||||
<h3 id="isauthenticatedorreadonly">IsAuthenticatedOrReadOnly<a class="headerlink" href="#isauthenticatedorreadonly" title="Permanent link">¶</a></h3>
|
||||
<p>The <code>IsAuthenticatedOrReadOnly</code> will allow authenticated users to perform any request. Requests for unauthenticated users will only be permitted if the request method is one of the "safe" methods; <code>GET</code>, <code>HEAD</code> or <code>OPTIONS</code>.</p>
|
||||
<p>This permission is suitable if you want to your API to allow read permissions to anonymous users, and only allow write permissions to authenticated users.</p>
|
||||
<h2 id="djangomodelpermissions">DjangoModelPermissions<a class="headerlink" href="#djangomodelpermissions" title="Permanent link">¶</a></h2>
|
||||
<h3 id="djangomodelpermissions">DjangoModelPermissions<a class="headerlink" href="#djangomodelpermissions" title="Permanent link">¶</a></h3>
|
||||
<p>This permission class ties into Django's standard <code>django.contrib.auth</code> <a href="https://docs.djangoproject.com/en/stable/topics/auth/customizing/#custom-permissions">model permissions</a>. This permission must only be applied to views that have a <code>.queryset</code> property or <code>get_queryset()</code> method. Authorization will only be granted if the user <em>is authenticated</em> and has the <em>relevant model permissions</em> assigned. The appropriate model is determined by checking <code>get_queryset().model</code> or <code>queryset.model</code>.</p>
|
||||
<ul>
|
||||
<li><code>POST</code> requests require the user to have the <code>add</code> permission on the model.</li>
|
||||
|
|
@ -2827,9 +3421,9 @@ class ExampleView(APIView):
|
|||
</ul>
|
||||
<p>The default behavior can also be overridden to support custom model permissions. For example, you might want to include a <code>view</code> model permission for <code>GET</code> requests.</p>
|
||||
<p>To use custom model permissions, override <code>DjangoModelPermissions</code> and set the <code>.perms_map</code> property. Refer to the source code for details.</p>
|
||||
<h2 id="djangomodelpermissionsoranonreadonly">DjangoModelPermissionsOrAnonReadOnly<a class="headerlink" href="#djangomodelpermissionsoranonreadonly" title="Permanent link">¶</a></h2>
|
||||
<h3 id="djangomodelpermissionsoranonreadonly">DjangoModelPermissionsOrAnonReadOnly<a class="headerlink" href="#djangomodelpermissionsoranonreadonly" title="Permanent link">¶</a></h3>
|
||||
<p>Similar to <code>DjangoModelPermissions</code>, but also allows unauthenticated users to have read-only access to the API.</p>
|
||||
<h2 id="djangoobjectpermissions">DjangoObjectPermissions<a class="headerlink" href="#djangoobjectpermissions" title="Permanent link">¶</a></h2>
|
||||
<h3 id="djangoobjectpermissions">DjangoObjectPermissions<a class="headerlink" href="#djangoobjectpermissions" title="Permanent link">¶</a></h3>
|
||||
<p>This permission class ties into Django's standard <a href="https://docs.djangoproject.com/en/stable/topics/auth/customizing/#handling-object-permissions">object permissions framework</a> that allows per-object permissions on models. In order to use this permission class, you'll also need to add a permission backend that supports object-level permissions, such as <a href="https://github.com/lukaszb/django-guardian">django-guardian</a>.</p>
|
||||
<p>As with <code>DjangoModelPermissions</code>, this permission must only be applied to views that have a <code>.queryset</code> property or <code>.get_queryset()</code> method. Authorization will only be granted if the user <em>is authenticated</em> and has the <em>relevant per-object permissions</em> and <em>relevant model permissions</em> assigned.</p>
|
||||
<ul>
|
||||
|
|
@ -2843,7 +3437,7 @@ class ExampleView(APIView):
|
|||
<p class="admonition-title">Note</p>
|
||||
<p>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>
|
||||
</div>
|
||||
<h1 id="custom-permissions">Custom permissions<a class="headerlink" href="#custom-permissions" title="Permanent link">¶</a></h1>
|
||||
<h2 id="custom-permissions">Custom permissions<a class="headerlink" href="#custom-permissions" title="Permanent link">¶</a></h2>
|
||||
<p>To implement a custom permission, override <code>BasePermission</code> and implement either, or both, of the following methods:</p>
|
||||
<ul>
|
||||
<li><code>.has_permission(self, request, view)</code></li>
|
||||
|
|
@ -2869,7 +3463,7 @@ class CustomerAccessPermission(permissions.BasePermission):
|
|||
def has_permission(self, request, view):
|
||||
...
|
||||
</code></pre></div>
|
||||
<h2 id="examples">Examples<a class="headerlink" href="#examples" title="Permanent link">¶</a></h2>
|
||||
<h3 id="examples">Examples<a class="headerlink" href="#examples" title="Permanent link">¶</a></h3>
|
||||
<p>The following is an example of a permission class that checks the incoming request's IP address against a blocklist, and denies the request if the IP has been blocked.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>from rest_framework import permissions
|
||||
|
||||
|
|
@ -2901,7 +3495,7 @@ class BlocklistPermission(permissions.BasePermission):
|
|||
</code></pre></div>
|
||||
<p>Note that the generic views will check the appropriate object level permissions, but if you're writing your own custom views, you'll need to make sure you check the object level permission checks yourself. You can do so by calling <code>self.check_object_permissions(request, obj)</code> from the view once you have the object instance. This call will raise an appropriate <code>APIException</code> if any object-level permission checks fail, and will otherwise simply return.</p>
|
||||
<p>Also note that the generic views will only check the object-level permissions for views that retrieve a single model instance. If you require object-level filtering of list views, you'll need to filter the queryset separately. See the <a href="../filtering/">filtering documentation</a> for more details.</p>
|
||||
<h1 id="overview-of-access-restriction-methods">Overview of access restriction methods<a class="headerlink" href="#overview-of-access-restriction-methods" title="Permanent link">¶</a></h1>
|
||||
<h2 id="overview-of-access-restriction-methods">Overview of access restriction methods<a class="headerlink" href="#overview-of-access-restriction-methods" title="Permanent link">¶</a></h2>
|
||||
<p>REST framework offers three different methods to customize access restrictions on a case-by-case basis. These apply in different scenarios and have different effects and limitations.</p>
|
||||
<ul>
|
||||
<li><code>queryset</code>/<code>get_queryset()</code>: Limits the general visibility of existing objects from the database. The queryset limits which objects will be listed and which objects can be modified or deleted. The <code>get_queryset()</code> method can apply different querysets based on the current action.</li>
|
||||
|
|
@ -2972,27 +3566,27 @@ class BlocklistPermission(permissions.BasePermission):
|
|||
<p>* A Serializer class should not raise PermissionDenied in a list action, or the entire list would not be returned. <br>
|
||||
** The <code>get_*()</code> methods have access to the current view and can return different Serializer or QuerySet instances based on the request or action.</p>
|
||||
<hr />
|
||||
<h1 id="third-party-packages">Third party packages<a class="headerlink" href="#third-party-packages" title="Permanent link">¶</a></h1>
|
||||
<h2 id="third-party-packages">Third party packages<a class="headerlink" href="#third-party-packages" title="Permanent link">¶</a></h2>
|
||||
<p>The following third party packages are also available.</p>
|
||||
<h2 id="drf-access-policy">DRF - Access Policy<a class="headerlink" href="#drf-access-policy" title="Permanent link">¶</a></h2>
|
||||
<h3 id="drf-access-policy">DRF - Access Policy<a class="headerlink" href="#drf-access-policy" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://github.com/rsinger86/drf-access-policy">Django REST - Access Policy</a> package provides a way to define complex access rules in declarative policy classes that are attached to view sets or function-based views. The policies are defined in JSON in a format similar to AWS' Identity & Access Management policies. </p>
|
||||
<h2 id="composed-permissions">Composed Permissions<a class="headerlink" href="#composed-permissions" title="Permanent link">¶</a></h2>
|
||||
<h3 id="composed-permissions">Composed Permissions<a class="headerlink" href="#composed-permissions" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://github.com/niwibe/djangorestframework-composed-permissions">Composed Permissions</a> package provides a simple way to define complex and multi-depth (with logic operators) permission objects, using small and reusable components.</p>
|
||||
<h2 id="rest-condition">REST Condition<a class="headerlink" href="#rest-condition" title="Permanent link">¶</a></h2>
|
||||
<h3 id="rest-condition">REST Condition<a class="headerlink" href="#rest-condition" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://github.com/caxap/rest_condition">REST Condition</a> package is another extension for building complex permissions in a simple and convenient way. The extension allows you to combine permissions with logical operators.</p>
|
||||
<h2 id="dry-rest-permissions">DRY Rest Permissions<a class="headerlink" href="#dry-rest-permissions" title="Permanent link">¶</a></h2>
|
||||
<h3 id="dry-rest-permissions">DRY Rest Permissions<a class="headerlink" href="#dry-rest-permissions" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://github.com/FJNR-inc/dry-rest-permissions">DRY Rest Permissions</a> package provides the ability to define different permissions for individual default and custom actions. This package is made for apps with permissions that are derived from relationships defined in the app's data model. It also supports permission checks being returned to a client app through the API's serializer. Additionally it supports adding permissions to the default and custom list actions to restrict the data they retrieve per user.</p>
|
||||
<h2 id="django-rest-framework-roles">Django Rest Framework Roles<a class="headerlink" href="#django-rest-framework-roles" title="Permanent link">¶</a></h2>
|
||||
<h3 id="django-rest-framework-roles">Django Rest Framework Roles<a class="headerlink" href="#django-rest-framework-roles" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://github.com/computer-lab/django-rest-framework-roles">Django Rest Framework Roles</a> package makes it easier to parameterize your API over multiple types of users.</p>
|
||||
<h2 id="rest-framework-roles">Rest Framework Roles<a class="headerlink" href="#rest-framework-roles" title="Permanent link">¶</a></h2>
|
||||
<h3 id="rest-framework-roles">Rest Framework Roles<a class="headerlink" href="#rest-framework-roles" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://github.com/Pithikos/rest-framework-roles">Rest Framework Roles</a> makes it super easy to protect views based on roles. Most importantly allows you to decouple accessibility logic from models and views in a clean human-readable way.</p>
|
||||
<h2 id="django-rest-framework-api-key">Django REST Framework API Key<a class="headerlink" href="#django-rest-framework-api-key" title="Permanent link">¶</a></h2>
|
||||
<h3 id="django-rest-framework-api-key">Django REST Framework API Key<a class="headerlink" href="#django-rest-framework-api-key" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://florimondmanca.github.io/djangorestframework-api-key/">Django REST Framework API Key</a> package provides permissions classes, models and helpers to add API key authorization to your API. It can be used to authorize internal or third-party backends and services (i.e. <em>machines</em>) which do not have a user account. API keys are stored securely using Django's password hashing infrastructure, and they can be viewed, edited and revoked at anytime in the Django admin.</p>
|
||||
<h2 id="django-rest-framework-role-filters">Django Rest Framework Role Filters<a class="headerlink" href="#django-rest-framework-role-filters" title="Permanent link">¶</a></h2>
|
||||
<h3 id="django-rest-framework-role-filters">Django Rest Framework Role Filters<a class="headerlink" href="#django-rest-framework-role-filters" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://github.com/allisson/django-rest-framework-role-filters">Django Rest Framework Role Filters</a> package provides simple filtering over multiple types of roles.</p>
|
||||
<h2 id="django-rest-framework-psq">Django Rest Framework PSQ<a class="headerlink" href="#django-rest-framework-psq" title="Permanent link">¶</a></h2>
|
||||
<h3 id="django-rest-framework-psq">Django Rest Framework PSQ<a class="headerlink" href="#django-rest-framework-psq" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://github.com/drf-psq/drf-psq">Django Rest Framework PSQ</a> package is an extension that gives support for having action-based <strong>permission_classes</strong>, <strong>serializer_class</strong>, and <strong>queryset</strong> dependent on permission-based rules.</p>
|
||||
<h2 id="axioms-drf-py">Axioms DRF PY<a class="headerlink" href="#axioms-drf-py" title="Permanent link">¶</a></h2>
|
||||
<h3 id="axioms-drf-py">Axioms DRF PY<a class="headerlink" href="#axioms-drf-py" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://github.com/abhishektiwari/axioms-drf-py">Axioms DRF PY</a> package is an extension that provides support for authentication and claim-based fine-grained authorization (<strong>scopes</strong>, <strong>roles</strong>, <strong>groups</strong>, <strong>permissions</strong>, etc. including object-level checks) using JWT tokens issued by an OAuth2/OIDC Authorization Server including AWS Cognito, Auth0, Okta, Microsoft Entra, etc.</p>
|
||||
|
||||
|
||||
|
|
@ -3056,7 +3650,7 @@ class BlocklistPermission(permissions.BasePermission):
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -1075,6 +1073,295 @@
|
|||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-reference" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Reference
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Reference">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#stringrelatedfield" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
StringRelatedField
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#primarykeyrelatedfield" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
PrimaryKeyRelatedField
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#hyperlinkedrelatedfield" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
HyperlinkedRelatedField
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#slugrelatedfield" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
SlugRelatedField
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#hyperlinkedidentityfield" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
HyperlinkedIdentityField
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#nested-relationships" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Nested relationships
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Nested relationships">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#writable-nested-serializers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Writable nested serializers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-relational-fields" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom relational fields
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom relational fields">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example_1" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-hyperlinked-fields" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom hyperlinked fields
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom hyperlinked fields">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example_2" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#further-notes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Further notes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Further notes">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-queryset-argument" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The queryset argument
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#customizing-the-html-display" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Customizing the HTML display
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#select-field-cutoffs" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Select field cutoffs
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#reverse-relations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Reverse relations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#generic-relationships" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Generic relationships
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#manytomanyfields-with-a-through-model" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ManyToManyFields with a Through Model
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third Party Packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Third Party Packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-nested-routers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DRF Nested Routers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#rest-framework-generic-relations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Rest Framework Generic Relations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -2590,6 +2877,332 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#inspecting-relationships" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Inspecting relationships.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-reference" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Reference
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Reference">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#stringrelatedfield" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
StringRelatedField
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#primarykeyrelatedfield" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
PrimaryKeyRelatedField
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#hyperlinkedrelatedfield" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
HyperlinkedRelatedField
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#slugrelatedfield" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
SlugRelatedField
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#hyperlinkedidentityfield" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
HyperlinkedIdentityField
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#nested-relationships" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Nested relationships
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Nested relationships">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#writable-nested-serializers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Writable nested serializers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-relational-fields" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom relational fields
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom relational fields">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example_1" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-hyperlinked-fields" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom hyperlinked fields
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom hyperlinked fields">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example_2" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#further-notes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Further notes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Further notes">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-queryset-argument" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The queryset argument
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#customizing-the-html-display" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Customizing the HTML display
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#select-field-cutoffs" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Select field cutoffs
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#reverse-relations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Reverse relations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#generic-relationships" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Generic relationships
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#manytomanyfields-with-a-through-model" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ManyToManyFields with a Through Model
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third Party Packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Third Party Packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-nested-routers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DRF Nested Routers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#rest-framework-generic-relations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Rest Framework Generic Relations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2687,7 +3300,7 @@ print(AlbumSerializer(qs, many=True).data)
|
|||
</code></pre></div>
|
||||
<p>would solve the issue.</p>
|
||||
</div>
|
||||
<h4 id="inspecting-relationships">Inspecting relationships.<a class="headerlink" href="#inspecting-relationships" title="Permanent link">¶</a></h4>
|
||||
<h2 id="inspecting-relationships">Inspecting relationships.<a class="headerlink" href="#inspecting-relationships" title="Permanent link">¶</a></h2>
|
||||
<p>When using the <code>ModelSerializer</code> class, serializer fields and relationships will be automatically generated for you. Inspecting these automatically generated fields can be a useful tool for determining how to customize the relationship style.</p>
|
||||
<p>To do so, open the Django shell, using <code>python manage.py shell</code>, then import the serializer class, instantiate it, and print the object representation…</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>>>> from myapp.serializers import AccountSerializer
|
||||
|
|
@ -2698,7 +3311,7 @@ AccountSerializer():
|
|||
name = CharField(allow_blank=True, max_length=100, required=False)
|
||||
owner = PrimaryKeyRelatedField(queryset=User.objects.all())
|
||||
</code></pre></div>
|
||||
<h1 id="api-reference">API Reference<a class="headerlink" href="#api-reference" title="Permanent link">¶</a></h1>
|
||||
<h2 id="api-reference">API Reference<a class="headerlink" href="#api-reference" title="Permanent link">¶</a></h2>
|
||||
<p>In order to explain the various types of relational fields, we'll use a couple of simple models for our examples. Our models will be for music albums, and the tracks listed on each album.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class Album(models.Model):
|
||||
album_name = models.CharField(max_length=100)
|
||||
|
|
@ -2717,7 +3330,7 @@ class Track(models.Model):
|
|||
def __str__(self):
|
||||
return '%d: %s' % (self.order, self.title)
|
||||
</code></pre></div>
|
||||
<h2 id="stringrelatedfield">StringRelatedField<a class="headerlink" href="#stringrelatedfield" title="Permanent link">¶</a></h2>
|
||||
<h3 id="stringrelatedfield">StringRelatedField<a class="headerlink" href="#stringrelatedfield" title="Permanent link">¶</a></h3>
|
||||
<p><code>StringRelatedField</code> may be used to represent the target of the relationship using its <code>__str__</code> method.</p>
|
||||
<p>For example, the following serializer:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class AlbumSerializer(serializers.ModelSerializer):
|
||||
|
|
@ -2744,7 +3357,7 @@ class Track(models.Model):
|
|||
<ul>
|
||||
<li><code>many</code> - If applied to a to-many relationship, you should set this argument to <code>True</code>.</li>
|
||||
</ul>
|
||||
<h2 id="primarykeyrelatedfield">PrimaryKeyRelatedField<a class="headerlink" href="#primarykeyrelatedfield" title="Permanent link">¶</a></h2>
|
||||
<h3 id="primarykeyrelatedfield">PrimaryKeyRelatedField<a class="headerlink" href="#primarykeyrelatedfield" title="Permanent link">¶</a></h3>
|
||||
<p><code>PrimaryKeyRelatedField</code> may be used to represent the target of the relationship using its primary key.</p>
|
||||
<p>For example, the following serializer:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class AlbumSerializer(serializers.ModelSerializer):
|
||||
|
|
@ -2774,7 +3387,7 @@ class Track(models.Model):
|
|||
<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>
|
||||
<li><code>pk_field</code> - Set to a field to control serialization/deserialization of the primary key's value. For example, <code>pk_field=UUIDField(format='hex')</code> would serialize a UUID primary key into its compact hex representation.</li>
|
||||
</ul>
|
||||
<h2 id="hyperlinkedrelatedfield">HyperlinkedRelatedField<a class="headerlink" href="#hyperlinkedrelatedfield" title="Permanent link">¶</a></h2>
|
||||
<h3 id="hyperlinkedrelatedfield">HyperlinkedRelatedField<a class="headerlink" href="#hyperlinkedrelatedfield" title="Permanent link">¶</a></h3>
|
||||
<p><code>HyperlinkedRelatedField</code> may be used to represent the target of the relationship using a hyperlink.</p>
|
||||
<p>For example, the following serializer:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class AlbumSerializer(serializers.ModelSerializer):
|
||||
|
|
@ -2817,7 +3430,7 @@ class Track(models.Model):
|
|||
<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>
|
||||
</ul>
|
||||
<h2 id="slugrelatedfield">SlugRelatedField<a class="headerlink" href="#slugrelatedfield" title="Permanent link">¶</a></h2>
|
||||
<h3 id="slugrelatedfield">SlugRelatedField<a class="headerlink" href="#slugrelatedfield" title="Permanent link">¶</a></h3>
|
||||
<p><code>SlugRelatedField</code> may be used to represent the target of the relationship using a field on the target.</p>
|
||||
<p>For example, the following serializer:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class AlbumSerializer(serializers.ModelSerializer):
|
||||
|
|
@ -2852,7 +3465,7 @@ class Track(models.Model):
|
|||
<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>
|
||||
</ul>
|
||||
<h2 id="hyperlinkedidentityfield">HyperlinkedIdentityField<a class="headerlink" href="#hyperlinkedidentityfield" title="Permanent link">¶</a></h2>
|
||||
<h3 id="hyperlinkedidentityfield">HyperlinkedIdentityField<a class="headerlink" href="#hyperlinkedidentityfield" title="Permanent link">¶</a></h3>
|
||||
<p>This field can be applied as an identity relationship, such as the <code>'url'</code> field on a HyperlinkedModelSerializer. It can also be used for an attribute on the object. For example, the following serializer:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class AlbumSerializer(serializers.HyperlinkedModelSerializer):
|
||||
track_listing = serializers.HyperlinkedIdentityField(view_name='track-list')
|
||||
|
|
@ -2877,12 +3490,12 @@ class Track(models.Model):
|
|||
<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>
|
||||
</ul>
|
||||
<hr />
|
||||
<h1 id="nested-relationships">Nested relationships<a class="headerlink" href="#nested-relationships" title="Permanent link">¶</a></h1>
|
||||
<h2 id="nested-relationships">Nested relationships<a class="headerlink" href="#nested-relationships" title="Permanent link">¶</a></h2>
|
||||
<p>As opposed to previously discussed <em>references</em> to another entity, the referred entity can instead also be embedded or <em>nested</em>
|
||||
in the representation of the object that refers to it.
|
||||
Such nested relationships can be expressed by using serializers as fields.</p>
|
||||
<p>If the field is used to represent a to-many relationship, you should add the <code>many=True</code> flag to the serializer field.</p>
|
||||
<h2 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h2>
|
||||
<h3 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h3>
|
||||
<p>For example, the following serializer:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class TrackSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
|
|
@ -2917,7 +3530,7 @@ class AlbumSerializer(serializers.ModelSerializer):
|
|||
],
|
||||
}
|
||||
</code></pre></div>
|
||||
<h2 id="writable-nested-serializers">Writable nested serializers<a class="headerlink" href="#writable-nested-serializers" title="Permanent link">¶</a></h2>
|
||||
<h3 id="writable-nested-serializers">Writable nested serializers<a class="headerlink" href="#writable-nested-serializers" title="Permanent link">¶</a></h3>
|
||||
<p>By default nested serializers are read-only. If you want to support write-operations to a nested serializer field you'll need to create <code>create()</code> and/or <code>update()</code> methods in order to explicitly specify how the child relationships should be saved:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class TrackSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
|
|
@ -2954,14 +3567,14 @@ True
|
|||
<Album: Album object>
|
||||
</code></pre></div>
|
||||
<hr />
|
||||
<h1 id="custom-relational-fields">Custom relational fields<a class="headerlink" href="#custom-relational-fields" title="Permanent link">¶</a></h1>
|
||||
<h2 id="custom-relational-fields">Custom relational fields<a class="headerlink" href="#custom-relational-fields" title="Permanent link">¶</a></h2>
|
||||
<p>In rare cases where none of the existing relational styles fit the representation you need,
|
||||
you can implement a completely custom relational field, that describes exactly how the
|
||||
output representation should be generated from the model instance.</p>
|
||||
<p>To implement a custom relational field, you should override <code>RelatedField</code>, and implement the <code>.to_representation(self, value)</code> method. This method takes the target of the field as the <code>value</code> argument, and should return the representation that should be used to serialize the target. The <code>value</code> argument will typically be a model instance.</p>
|
||||
<p>If you want to implement a read-write relational field, you must also implement the <a href="https://www.django-rest-framework.org/api-guide/serializers/#to_internal_valueself-data"><code>.to_internal_value(self, data)</code> method</a>.</p>
|
||||
<p>To provide a dynamic queryset based on the <code>context</code>, you can also override <code>.get_queryset(self)</code> instead of specifying <code>.queryset</code> on the class or when initializing the field.</p>
|
||||
<h2 id="example_1">Example<a class="headerlink" href="#example_1" title="Permanent link">¶</a></h2>
|
||||
<h3 id="example_1">Example<a class="headerlink" href="#example_1" title="Permanent link">¶</a></h3>
|
||||
<p>For example, we could define a relational field to serialize a track to a custom string representation, using its ordering, title, and duration:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>import time
|
||||
|
||||
|
|
@ -2990,7 +3603,7 @@ class AlbumSerializer(serializers.ModelSerializer):
|
|||
}
|
||||
</code></pre></div>
|
||||
<hr />
|
||||
<h1 id="custom-hyperlinked-fields">Custom hyperlinked fields<a class="headerlink" href="#custom-hyperlinked-fields" title="Permanent link">¶</a></h1>
|
||||
<h2 id="custom-hyperlinked-fields">Custom hyperlinked fields<a class="headerlink" href="#custom-hyperlinked-fields" title="Permanent link">¶</a></h2>
|
||||
<p>In some cases you may need to customize the behavior of a hyperlinked field, in order to represent URLs that require more than a single lookup field.</p>
|
||||
<p>You can achieve this by overriding <code>HyperlinkedRelatedField</code>. There are two methods that may be overridden:</p>
|
||||
<p><strong>get_url(self, obj, view_name, request, format)</strong></p>
|
||||
|
|
@ -3001,7 +3614,7 @@ attributes are not configured to correctly match the URL conf.</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>
|
||||
<h2 id="example_2">Example<a class="headerlink" href="#example_2" title="Permanent link">¶</a></h2>
|
||||
<h3 id="example_2">Example<a class="headerlink" href="#example_2" title="Permanent link">¶</a></h3>
|
||||
<p>Say we have a URL for a customer object that takes two keyword arguments, like so:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>/api/<organization_slug>/customers/<customer_pk>/
|
||||
</code></pre></div>
|
||||
|
|
@ -3032,20 +3645,20 @@ class CustomerHyperlink(serializers.HyperlinkedRelatedField):
|
|||
<p>Note that if you wanted to use this style together with the generic views then you'd also need to override <code>.get_object</code> on the view in order to get the correct lookup behavior.</p>
|
||||
<p>Generally we recommend a flat style for API representations where possible, but the nested URL style can also be reasonable when used in moderation.</p>
|
||||
<hr />
|
||||
<h1 id="further-notes">Further notes<a class="headerlink" href="#further-notes" title="Permanent link">¶</a></h1>
|
||||
<h2 id="the-queryset-argument">The <code>queryset</code> argument<a class="headerlink" href="#the-queryset-argument" title="Permanent link">¶</a></h2>
|
||||
<h2 id="further-notes">Further notes<a class="headerlink" href="#further-notes" title="Permanent link">¶</a></h2>
|
||||
<h3 id="the-queryset-argument">The <code>queryset</code> argument<a class="headerlink" href="#the-queryset-argument" title="Permanent link">¶</a></h3>
|
||||
<p>The <code>queryset</code> argument is only ever required for <em>writable</em> relationship field, in which case it is used for performing the model instance lookup, that maps from the primitive user input, into a model instance.</p>
|
||||
<p>In version 2.x a serializer class could <em>sometimes</em> automatically determine the <code>queryset</code> argument <em>if</em> a <code>ModelSerializer</code> class was being used.</p>
|
||||
<p>This behavior is now replaced with <em>always</em> using an explicit <code>queryset</code> argument for writable relational fields.</p>
|
||||
<p>Doing so reduces the amount of hidden 'magic' that <code>ModelSerializer</code> provides, makes the behavior of the field more clear, and ensures that it is trivial to move between using the <code>ModelSerializer</code> shortcut, or using fully explicit <code>Serializer</code> classes.</p>
|
||||
<h2 id="customizing-the-html-display">Customizing the HTML display<a class="headerlink" href="#customizing-the-html-display" title="Permanent link">¶</a></h2>
|
||||
<h3 id="customizing-the-html-display">Customizing the HTML display<a class="headerlink" href="#customizing-the-html-display" title="Permanent link">¶</a></h3>
|
||||
<p>The built-in <code>__str__</code> method of the model will be used to generate string representations of the objects used to populate the <code>choices</code> property. These choices are used to populate select HTML inputs in the browsable API.</p>
|
||||
<p>To provide customized representations for such inputs, override <code>display_value()</code> of a <code>RelatedField</code> subclass. This method will receive a model object, and should return a string suitable for representing it. For example:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class TrackPrimaryKeyRelatedField(serializers.PrimaryKeyRelatedField):
|
||||
def display_value(self, instance):
|
||||
return 'Track: %s' % (instance.title)
|
||||
</code></pre></div>
|
||||
<h2 id="select-field-cutoffs">Select field cutoffs<a class="headerlink" href="#select-field-cutoffs" title="Permanent link">¶</a></h2>
|
||||
<h3 id="select-field-cutoffs">Select field cutoffs<a class="headerlink" href="#select-field-cutoffs" title="Permanent link">¶</a></h3>
|
||||
<p>When rendered in the browsable API relational fields will default to only displaying a maximum of 1000 selectable items. If more items are present then a disabled option with "More than 1000 items…" will be displayed.</p>
|
||||
<p>This behavior is intended to prevent a template from being unable to render in an acceptable timespan due to a very large number of relationships being displayed.</p>
|
||||
<p>There are two keyword arguments you can use to control this behavior:</p>
|
||||
|
|
@ -3061,7 +3674,7 @@ class CustomerHyperlink(serializers.HyperlinkedRelatedField):
|
|||
style={'base_template': 'input.html'}
|
||||
)
|
||||
</code></pre></div>
|
||||
<h2 id="reverse-relations">Reverse relations<a class="headerlink" href="#reverse-relations" title="Permanent link">¶</a></h2>
|
||||
<h3 id="reverse-relations">Reverse relations<a class="headerlink" href="#reverse-relations" title="Permanent link">¶</a></h3>
|
||||
<p>Note that reverse relationships are not automatically included by the <code>ModelSerializer</code> and <code>HyperlinkedModelSerializer</code> classes. To include a reverse relationship, you must explicitly add it to the fields list. For example:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class AlbumSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
|
|
@ -3078,7 +3691,7 @@ class CustomerHyperlink(serializers.HyperlinkedRelatedField):
|
|||
fields = ['track_set', ...]
|
||||
</code></pre></div>
|
||||
<p>See the Django documentation on <a href="https://docs.djangoproject.com/en/stable/topics/db/queries/#following-relationships-backward">reverse relationships</a> for more details.</p>
|
||||
<h2 id="generic-relationships">Generic relationships<a class="headerlink" href="#generic-relationships" title="Permanent link">¶</a></h2>
|
||||
<h3 id="generic-relationships">Generic relationships<a class="headerlink" href="#generic-relationships" title="Permanent link">¶</a></h3>
|
||||
<p>If you want to serialize a generic foreign key, you need to define a custom field, to determine explicitly how you want to serialize the targets of the relationship.</p>
|
||||
<p>For example, given the following model for a tag, which has a generic relationship with other arbitrary models:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class TaggedItem(models.Model):
|
||||
|
|
@ -3144,7 +3757,7 @@ class Note(models.Model):
|
|||
</code></pre></div>
|
||||
<p>Note that reverse generic keys, expressed using the <code>GenericRelation</code> field, can be serialized using the regular relational field types, since the type of the target in the relationship is always known.</p>
|
||||
<p>For more information see <a href="https://docs.djangoproject.com/en/stable/ref/contrib/contenttypes/#id1">the Django documentation on generic relations</a>.</p>
|
||||
<h2 id="manytomanyfields-with-a-through-model">ManyToManyFields with a Through Model<a class="headerlink" href="#manytomanyfields-with-a-through-model" title="Permanent link">¶</a></h2>
|
||||
<h3 id="manytomanyfields-with-a-through-model">ManyToManyFields with a Through Model<a class="headerlink" href="#manytomanyfields-with-a-through-model" title="Permanent link">¶</a></h3>
|
||||
<p>By default, relational fields that target a <code>ManyToManyField</code> with a
|
||||
<code>through</code> model specified are set to read-only.</p>
|
||||
<p>If you explicitly specify a relational field pointing to a
|
||||
|
|
@ -3152,11 +3765,11 @@ class Note(models.Model):
|
|||
to <code>True</code>.</p>
|
||||
<p>If you wish to represent <a href="https://docs.djangoproject.com/en/stable/topics/db/models/#intermediary-manytomany">extra fields on a through model</a> then you may serialize the through model as <a href="https://www.django-rest-framework.org/api-guide/serializers/#dealing-with-nested-objects">a nested object</a>.</p>
|
||||
<hr />
|
||||
<h1 id="third-party-packages">Third Party Packages<a class="headerlink" href="#third-party-packages" title="Permanent link">¶</a></h1>
|
||||
<h2 id="third-party-packages">Third Party Packages<a class="headerlink" href="#third-party-packages" title="Permanent link">¶</a></h2>
|
||||
<p>The following third party packages are also available.</p>
|
||||
<h2 id="drf-nested-routers">DRF Nested Routers<a class="headerlink" href="#drf-nested-routers" title="Permanent link">¶</a></h2>
|
||||
<h3 id="drf-nested-routers">DRF Nested Routers<a class="headerlink" href="#drf-nested-routers" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://github.com/alanjds/drf-nested-routers">drf-nested-routers package</a> provides routers and relationship fields for working with nested resources.</p>
|
||||
<h2 id="rest-framework-generic-relations">Rest Framework Generic Relations<a class="headerlink" href="#rest-framework-generic-relations" title="Permanent link">¶</a></h2>
|
||||
<h3 id="rest-framework-generic-relations">Rest Framework Generic Relations<a class="headerlink" href="#rest-framework-generic-relations" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://github.com/Ian-Foote/rest-framework-generic-relations">rest-framework-generic-relations</a> library provides read/write serialization for generic foreign keys.</p>
|
||||
<p>The <a href="https://github.com/mojtabaakbari221b/rest-framework-gm2m-relations">rest-framework-gm2m-relations</a> library provides read/write serialization for <a href="https://github.com/tkhyn/django-gm2m">django-gm2m</a>.</p>
|
||||
|
||||
|
|
@ -3221,7 +3834,7 @@ to <code>True</code>.</p>
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -82,7 +82,7 @@
|
|||
<div data-md-component="skip">
|
||||
|
||||
|
||||
<a href="#requests" class="md-skip">
|
||||
<a href="#request-parsing" class="md-skip">
|
||||
Skip to content
|
||||
</a>
|
||||
|
||||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -733,8 +731,24 @@
|
|||
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
|
||||
|
||||
Requests
|
||||
|
||||
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
</label>
|
||||
|
||||
<a href="./" class="md-nav__link md-nav__link--active">
|
||||
|
||||
|
|
@ -753,6 +767,223 @@
|
|||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#request-parsing" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Request parsing
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Request parsing">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#data" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.data
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#query_params" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.query_params
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#parsers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.parsers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#content-negotiation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Content negotiation
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Content negotiation">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#accepted_renderer" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.accepted_renderer
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#accepted_media_type" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.accepted_media_type
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#authentication" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Authentication
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Authentication">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#user" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.user
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#auth" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.auth
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#authenticators" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.authenticators
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#browser-enhancements" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Browser enhancements
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Browser enhancements">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#method" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.method
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#content_type" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.content_type
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#stream" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.stream
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#standard-httprequest-attributes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Standard HttpRequest attributes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
|
@ -2542,6 +2773,230 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#request-parsing" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Request parsing
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Request parsing">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#data" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.data
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#query_params" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.query_params
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#parsers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.parsers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#content-negotiation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Content negotiation
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Content negotiation">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#accepted_renderer" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.accepted_renderer
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#accepted_media_type" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.accepted_media_type
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#authentication" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Authentication
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Authentication">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#user" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.user
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#auth" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.auth
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#authenticators" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.authenticators
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#browser-enhancements" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Browser enhancements
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Browser enhancements">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#method" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.method
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#content_type" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.content_type
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#stream" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.stream
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#standard-httprequest-attributes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Standard HttpRequest attributes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2603,16 +3058,17 @@
|
|||
|
||||
|
||||
|
||||
<h1 id="requests">Requests<a class="headerlink" href="#requests" title="Permanent link">¶</a></h1>
|
||||
<h1>Requests</h1>
|
||||
|
||||
<blockquote>
|
||||
<p>If you're doing REST-based web service stuff ... you should ignore request.POST.</p>
|
||||
<p>— Malcom Tredinnick, <a href="https://groups.google.com/d/topic/django-developers/dxI4qVzrBY4/discussion">Django developers group</a></p>
|
||||
</blockquote>
|
||||
<p>REST framework's <code>Request</code> class extends the standard <code>HttpRequest</code>, adding support for REST framework's flexible request parsing and request authentication.</p>
|
||||
<hr />
|
||||
<h1 id="request-parsing">Request parsing<a class="headerlink" href="#request-parsing" title="Permanent link">¶</a></h1>
|
||||
<h2 id="request-parsing">Request parsing<a class="headerlink" href="#request-parsing" title="Permanent link">¶</a></h2>
|
||||
<p>REST framework's Request objects provide flexible request parsing that allows you to treat requests with JSON data or other media types in the same way that you would normally deal with form data.</p>
|
||||
<h2 id="data">.data<a class="headerlink" href="#data" title="Permanent link">¶</a></h2>
|
||||
<h3 id="data">.data<a class="headerlink" href="#data" title="Permanent link">¶</a></h3>
|
||||
<p><code>request.data</code> returns the parsed content of the request body. This is similar to the standard <code>request.POST</code> and <code>request.FILES</code> attributes except that:</p>
|
||||
<ul>
|
||||
<li>It includes all parsed content, including <em>file and non-file</em> inputs.</li>
|
||||
|
|
@ -2620,10 +3076,10 @@
|
|||
<li>It supports REST framework's flexible request parsing, rather than just supporting form data. For example you can handle incoming <a href="../parsers/#jsonparser">JSON data</a> similarly to how you handle incoming <a href="../parsers/#formparser">form data</a>.</li>
|
||||
</ul>
|
||||
<p>For more details see the <a href="../parsers/">parsers documentation</a>.</p>
|
||||
<h2 id="query_params">.query_params<a class="headerlink" href="#query_params" title="Permanent link">¶</a></h2>
|
||||
<h3 id="query_params">.query_params<a class="headerlink" href="#query_params" title="Permanent link">¶</a></h3>
|
||||
<p><code>request.query_params</code> is a more correctly named synonym for <code>request.GET</code>.</p>
|
||||
<p>For clarity inside your code, we recommend using <code>request.query_params</code> instead of the Django's standard <code>request.GET</code>. Doing so will help keep your codebase more correct and obvious - any HTTP method type may include query parameters, not just <code>GET</code> requests.</p>
|
||||
<h2 id="parsers">.parsers<a class="headerlink" href="#parsers" title="Permanent link">¶</a></h2>
|
||||
<h3 id="parsers">.parsers<a class="headerlink" href="#parsers" title="Permanent link">¶</a></h3>
|
||||
<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>Parser</code> instances, based on the <code>parser_classes</code> set on the view or based on the <code>DEFAULT_PARSER_CLASSES</code> setting.</p>
|
||||
<p>You won't typically need to access this property.</p>
|
||||
<div class="admonition note">
|
||||
|
|
@ -2631,51 +3087,51 @@
|
|||
<p>If a client sends malformed content, then accessing <code>request.data</code> may raise a <code>ParseError</code>. By default REST framework's <code>APIView</code> class or <code>@api_view</code> decorator will catch the error and return a <code>400 Bad Request</code> response.</p>
|
||||
<p>If a client sends a request with a content-type that cannot be parsed then a <code>UnsupportedMediaType</code> exception will be raised, which by default will be caught and return a <code>415 Unsupported Media Type</code> response.</p>
|
||||
</div>
|
||||
<h1 id="content-negotiation">Content negotiation<a class="headerlink" href="#content-negotiation" title="Permanent link">¶</a></h1>
|
||||
<h2 id="content-negotiation">Content negotiation<a class="headerlink" href="#content-negotiation" title="Permanent link">¶</a></h2>
|
||||
<p>The request exposes some properties that allow you to determine the result of the content negotiation stage. This allows you to implement behavior such as selecting a different serialization schemes for different media types.</p>
|
||||
<h2 id="accepted_renderer">.accepted_renderer<a class="headerlink" href="#accepted_renderer" title="Permanent link">¶</a></h2>
|
||||
<h3 id="accepted_renderer">.accepted_renderer<a class="headerlink" href="#accepted_renderer" title="Permanent link">¶</a></h3>
|
||||
<p>The renderer instance that was selected by the content negotiation stage.</p>
|
||||
<h2 id="accepted_media_type">.accepted_media_type<a class="headerlink" href="#accepted_media_type" title="Permanent link">¶</a></h2>
|
||||
<h3 id="accepted_media_type">.accepted_media_type<a class="headerlink" href="#accepted_media_type" title="Permanent link">¶</a></h3>
|
||||
<p>A string representing the media type that was accepted by the content negotiation stage.</p>
|
||||
<hr />
|
||||
<h1 id="authentication">Authentication<a class="headerlink" href="#authentication" title="Permanent link">¶</a></h1>
|
||||
<h2 id="authentication">Authentication<a class="headerlink" href="#authentication" title="Permanent link">¶</a></h2>
|
||||
<p>REST framework provides flexible, per-request authentication, that gives you the ability to:</p>
|
||||
<ul>
|
||||
<li>Use different authentication policies for different parts of your API.</li>
|
||||
<li>Support the use of multiple authentication policies.</li>
|
||||
<li>Provide both user and token information associated with the incoming request.</li>
|
||||
</ul>
|
||||
<h2 id="user">.user<a class="headerlink" href="#user" title="Permanent link">¶</a></h2>
|
||||
<h3 id="user">.user<a class="headerlink" href="#user" title="Permanent link">¶</a></h3>
|
||||
<p><code>request.user</code> typically returns an instance of <code>django.contrib.auth.models.User</code>, although the behavior depends on the authentication policy being used.</p>
|
||||
<p>If the request is unauthenticated the default value of <code>request.user</code> is an instance of <code>django.contrib.auth.models.AnonymousUser</code>.</p>
|
||||
<p>For more details see the <a href="../authentication/">authentication documentation</a>.</p>
|
||||
<h2 id="auth">.auth<a class="headerlink" href="#auth" title="Permanent link">¶</a></h2>
|
||||
<h3 id="auth">.auth<a class="headerlink" href="#auth" title="Permanent link">¶</a></h3>
|
||||
<p><code>request.auth</code> returns any additional authentication context. The exact behavior of <code>request.auth</code> depends on the authentication policy being used, but it may typically be an instance of the token that the request was authenticated against.</p>
|
||||
<p>If the request is unauthenticated, or if no additional context is present, the default value of <code>request.auth</code> is <code>None</code>.</p>
|
||||
<p>For more details see the <a href="../authentication/">authentication documentation</a>.</p>
|
||||
<h2 id="authenticators">.authenticators<a class="headerlink" href="#authenticators" title="Permanent link">¶</a></h2>
|
||||
<h3 id="authenticators">.authenticators<a class="headerlink" href="#authenticators" title="Permanent link">¶</a></h3>
|
||||
<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>
|
||||
<div class="admonition note">
|
||||
<p class="admonition-title">Note</p>
|
||||
<p>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> originates 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>
|
||||
</div>
|
||||
<h1 id="browser-enhancements">Browser enhancements<a class="headerlink" href="#browser-enhancements" title="Permanent link">¶</a></h1>
|
||||
<h2 id="browser-enhancements">Browser enhancements<a class="headerlink" href="#browser-enhancements" title="Permanent link">¶</a></h2>
|
||||
<p>REST framework supports a few browser enhancements such as browser-based <code>PUT</code>, <code>PATCH</code> and <code>DELETE</code> forms.</p>
|
||||
<h2 id="method">.method<a class="headerlink" href="#method" title="Permanent link">¶</a></h2>
|
||||
<h3 id="method">.method<a class="headerlink" href="#method" title="Permanent link">¶</a></h3>
|
||||
<p><code>request.method</code> returns the <strong>uppercased</strong> string representation of the request's HTTP method.</p>
|
||||
<p>Browser-based <code>PUT</code>, <code>PATCH</code> and <code>DELETE</code> forms are transparently supported.</p>
|
||||
<p>For more information see the <a href="../../topics/browser-enhancements/">browser enhancements documentation</a>.</p>
|
||||
<h2 id="content_type">.content_type<a class="headerlink" href="#content_type" title="Permanent link">¶</a></h2>
|
||||
<h3 id="content_type">.content_type<a class="headerlink" href="#content_type" title="Permanent link">¶</a></h3>
|
||||
<p><code>request.content_type</code>, returns a string object representing the media type of the HTTP request's body, or an empty string if no media type was provided.</p>
|
||||
<p>You won't typically need to directly access the request's content type, as you'll normally rely on REST framework's default request parsing behavior.</p>
|
||||
<p>If you do need to access the content type of the request you should use the <code>.content_type</code> property in preference to using <code>request.META.get('HTTP_CONTENT_TYPE')</code>, as it provides transparent support for browser-based non-form content.</p>
|
||||
<p>For more information see the <a href="../../topics/browser-enhancements/">browser enhancements documentation</a>.</p>
|
||||
<h2 id="stream">.stream<a class="headerlink" href="#stream" title="Permanent link">¶</a></h2>
|
||||
<h3 id="stream">.stream<a class="headerlink" href="#stream" title="Permanent link">¶</a></h3>
|
||||
<p><code>request.stream</code> returns a stream representing the content of the request body.</p>
|
||||
<p>You won't typically need to directly access the request's content, as you'll normally rely on REST framework's default request parsing behavior.</p>
|
||||
<hr />
|
||||
<h1 id="standard-httprequest-attributes">Standard HttpRequest attributes<a class="headerlink" href="#standard-httprequest-attributes" title="Permanent link">¶</a></h1>
|
||||
<h2 id="standard-httprequest-attributes">Standard HttpRequest attributes<a class="headerlink" href="#standard-httprequest-attributes" title="Permanent link">¶</a></h2>
|
||||
<p>As REST framework's <code>Request</code> extends Django's <code>HttpRequest</code>, all the other standard attributes and methods are also available. For example the <code>request.META</code> and <code>request.session</code> dictionaries are available as normal.</p>
|
||||
<p>Note that due to implementation reasons the <code>Request</code> class does not inherit from <code>HttpRequest</code> class, but instead extends the class using composition.</p>
|
||||
|
||||
|
|
@ -2740,7 +3196,7 @@
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -764,6 +762,24 @@
|
|||
|
||||
|
||||
|
||||
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
|
||||
|
||||
Responses
|
||||
|
||||
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
</label>
|
||||
|
||||
<a href="./" class="md-nav__link md-nav__link--active">
|
||||
|
||||
|
||||
|
|
@ -781,6 +797,175 @@
|
|||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#creating-responses" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Creating responses
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Creating responses">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#response" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Response()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#attributes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Attributes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Attributes">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#data" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.data
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#status_code" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.status_code
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#content" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.content
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#template_name" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.template_name
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#accepted_renderer" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.accepted_renderer
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#accepted_media_type" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.accepted_media_type
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#renderer_context" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.renderer_context
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#standard-httpresponse-attributes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Standard HttpResponse attributes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Standard HttpResponse attributes">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#render" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.render()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
|
@ -2542,6 +2727,182 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#creating-responses" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Creating responses
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Creating responses">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#response" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Response()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#attributes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Attributes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Attributes">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#data" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.data
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#status_code" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.status_code
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#content" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.content
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#template_name" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.template_name
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#accepted_renderer" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.accepted_renderer
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#accepted_media_type" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.accepted_media_type
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#renderer_context" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.renderer_context
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#standard-httpresponse-attributes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Standard HttpResponse attributes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Standard HttpResponse attributes">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#render" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.render()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2613,8 +2974,8 @@
|
|||
<p>There's no requirement for you to use the <code>Response</code> class, you can also return regular <code>HttpResponse</code> or <code>StreamingHttpResponse</code> objects from your views if required. Using the <code>Response</code> class simply provides a nicer interface for returning content-negotiated Web API responses, that can be rendered to multiple formats.</p>
|
||||
<p>Unless you want to heavily customize REST framework for some reason, you should always use an <code>APIView</code> class or <code>@api_view</code> function for views that return <code>Response</code> objects. Doing so ensures that the view can perform content negotiation and select the appropriate renderer for the response, before it is returned from the view.</p>
|
||||
<hr />
|
||||
<h1 id="creating-responses">Creating responses<a class="headerlink" href="#creating-responses" title="Permanent link">¶</a></h1>
|
||||
<h2 id="response">Response()<a class="headerlink" href="#response" title="Permanent link">¶</a></h2>
|
||||
<h2 id="creating-responses">Creating responses<a class="headerlink" href="#creating-responses" title="Permanent link">¶</a></h2>
|
||||
<h3 id="response">Response()<a class="headerlink" href="#response" title="Permanent link">¶</a></h3>
|
||||
<p><strong>Signature:</strong> <code>Response(data, status=None, template_name=None, headers=None, content_type=None)</code></p>
|
||||
<p>Unlike regular <code>HttpResponse</code> objects, you do not instantiate <code>Response</code> objects with rendered content. Instead you pass in unrendered data, which may consist of any Python primitives.</p>
|
||||
<p>The renderers used by the <code>Response</code> class cannot natively handle complex datatypes such as Django model instances, so you need to serialize the data into primitive datatypes before creating the <code>Response</code> object.</p>
|
||||
|
|
@ -2628,31 +2989,31 @@
|
|||
<li><code>content_type</code>: The content type of the response. Typically, this will be set automatically by the renderer as determined by content negotiation, but there may be some cases where you need to specify the content type explicitly.</li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h1 id="attributes">Attributes<a class="headerlink" href="#attributes" title="Permanent link">¶</a></h1>
|
||||
<h2 id="data">.data<a class="headerlink" href="#data" title="Permanent link">¶</a></h2>
|
||||
<h2 id="attributes">Attributes<a class="headerlink" href="#attributes" title="Permanent link">¶</a></h2>
|
||||
<h3 id="data">.data<a class="headerlink" href="#data" title="Permanent link">¶</a></h3>
|
||||
<p>The unrendered, serialized data of the response.</p>
|
||||
<h2 id="status_code">.status_code<a class="headerlink" href="#status_code" title="Permanent link">¶</a></h2>
|
||||
<h3 id="status_code">.status_code<a class="headerlink" href="#status_code" title="Permanent link">¶</a></h3>
|
||||
<p>The numeric status code of the HTTP response.</p>
|
||||
<h2 id="content">.content<a class="headerlink" href="#content" title="Permanent link">¶</a></h2>
|
||||
<h3 id="content">.content<a class="headerlink" href="#content" title="Permanent link">¶</a></h3>
|
||||
<p>The rendered content of the response. The <code>.render()</code> method must have been called before <code>.content</code> can be accessed.</p>
|
||||
<h2 id="template_name">.template_name<a class="headerlink" href="#template_name" title="Permanent link">¶</a></h2>
|
||||
<h3 id="template_name">.template_name<a class="headerlink" href="#template_name" title="Permanent link">¶</a></h3>
|
||||
<p>The <code>template_name</code>, if supplied. Only required if <code>HTMLRenderer</code> or some other custom template renderer is the accepted renderer for the response.</p>
|
||||
<h2 id="accepted_renderer">.accepted_renderer<a class="headerlink" href="#accepted_renderer" title="Permanent link">¶</a></h2>
|
||||
<h3 id="accepted_renderer">.accepted_renderer<a class="headerlink" href="#accepted_renderer" title="Permanent link">¶</a></h3>
|
||||
<p>The renderer instance that will be used to render the response.</p>
|
||||
<p>Set automatically by the <code>APIView</code> or <code>@api_view</code> immediately before the response is returned from the view.</p>
|
||||
<h2 id="accepted_media_type">.accepted_media_type<a class="headerlink" href="#accepted_media_type" title="Permanent link">¶</a></h2>
|
||||
<h3 id="accepted_media_type">.accepted_media_type<a class="headerlink" href="#accepted_media_type" title="Permanent link">¶</a></h3>
|
||||
<p>The media type that was selected by the content negotiation stage.</p>
|
||||
<p>Set automatically by the <code>APIView</code> or <code>@api_view</code> immediately before the response is returned from the view.</p>
|
||||
<h2 id="renderer_context">.renderer_context<a class="headerlink" href="#renderer_context" title="Permanent link">¶</a></h2>
|
||||
<h3 id="renderer_context">.renderer_context<a class="headerlink" href="#renderer_context" title="Permanent link">¶</a></h3>
|
||||
<p>A dictionary of additional context information that will be passed to the renderer's <code>.render()</code> method.</p>
|
||||
<p>Set automatically by the <code>APIView</code> or <code>@api_view</code> immediately before the response is returned from the view.</p>
|
||||
<hr />
|
||||
<h1 id="standard-httpresponse-attributes">Standard HttpResponse attributes<a class="headerlink" href="#standard-httpresponse-attributes" title="Permanent link">¶</a></h1>
|
||||
<h2 id="standard-httpresponse-attributes">Standard HttpResponse attributes<a class="headerlink" href="#standard-httpresponse-attributes" title="Permanent link">¶</a></h2>
|
||||
<p>The <code>Response</code> class extends <code>SimpleTemplateResponse</code>, and all the usual attributes and methods are also available on the response. For example you can set headers on the response in the standard way:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>response = Response()
|
||||
response['Cache-Control'] = 'no-cache'
|
||||
</code></pre></div>
|
||||
<h2 id="render">.render()<a class="headerlink" href="#render" title="Permanent link">¶</a></h2>
|
||||
<h3 id="render">.render()<a class="headerlink" href="#render" title="Permanent link">¶</a></h3>
|
||||
<p><strong>Signature:</strong> <code>.render()</code></p>
|
||||
<p>As with any other <code>TemplateResponse</code>, this method is called to render the serialized data of the response into the final response content. When <code>.render()</code> is called, the response content will be set to the result of calling the <code>.render(data, accepted_media_type, renderer_context)</code> method on the <code>accepted_renderer</code> instance.</p>
|
||||
<p>You won't typically need to call <code>.render()</code> yourself, as it's handled by Django's standard response cycle.</p>
|
||||
|
|
@ -2718,7 +3079,7 @@ response['Cache-Control'] = 'no-cache'
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2601,6 +2599,54 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#reverse" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
reverse
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#reverse_lazy" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
reverse_lazy
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2762,7 +2808,7 @@ class APIRootView(APIView):
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -974,6 +972,145 @@
|
|||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-guide" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Guide
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Guide">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#simplerouter" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
SimpleRouter
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#defaultrouter" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DefaultRouter
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-routers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom Routers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom Routers">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#customizing-dynamic-routes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Customizing dynamic routes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#advanced-custom-routers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Advanced custom routers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third Party Packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Third Party Packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-nested-routers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DRF Nested Routers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#modelrouter-wqdbrest" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ModelRouter (wq.db.rest)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-extensions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DRF-extensions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -2629,6 +2766,221 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#usage" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Usage
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Usage">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-include-with-routers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using include with routers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#routing-for-extra-actions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Routing for extra actions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-django-path-with-routers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using Django path() with routers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-guide" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Guide
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Guide">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#simplerouter" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
SimpleRouter
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#defaultrouter" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DefaultRouter
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-routers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom Routers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom Routers">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#customizing-dynamic-routes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Customizing dynamic routes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#advanced-custom-routers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Advanced custom routers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third Party Packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Third Party Packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-nested-routers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DRF Nested Routers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#modelrouter-wqdbrest" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ModelRouter (wq.db.rest)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-extensions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DRF-extensions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2820,8 +3172,8 @@ class MyPathModelViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet):
|
|||
lookup_value_converter = 'uuid'
|
||||
</code></pre></div>
|
||||
<p>Note that path converters will be used on all URLs registered in the router, including viewset actions.</p>
|
||||
<h1 id="api-guide">API Guide<a class="headerlink" href="#api-guide" title="Permanent link">¶</a></h1>
|
||||
<h2 id="simplerouter">SimpleRouter<a class="headerlink" href="#simplerouter" title="Permanent link">¶</a></h2>
|
||||
<h2 id="api-guide">API Guide<a class="headerlink" href="#api-guide" title="Permanent link">¶</a></h2>
|
||||
<h3 id="simplerouter">SimpleRouter<a class="headerlink" href="#simplerouter" title="Permanent link">¶</a></h3>
|
||||
<p>This router includes routes for the standard set of <code>list</code>, <code>create</code>, <code>retrieve</code>, <code>update</code>, <code>partial_update</code> and <code>destroy</code> actions. The viewset can also mark additional methods to be routed, using the <code>@action</code> decorator.</p>
|
||||
<table border=1>
|
||||
<tr><th>URL Style</th><th>HTTP Method</th><th>Action</th><th>URL Name</th></tr>
|
||||
|
|
@ -2840,7 +3192,7 @@ This behavior can be modified by setting the <code>trailing_slash</code> argumen
|
|||
<div class="language-text highlight"><pre><span></span><code>router = SimpleRouter(trailing_slash=False)
|
||||
</code></pre></div>
|
||||
<p>Trailing slashes are conventional in Django, but are not used by default in some other frameworks such as Rails. Which style you choose to use is largely a matter of preference, although some javascript frameworks may expect a particular routing style.</p>
|
||||
<h2 id="defaultrouter">DefaultRouter<a class="headerlink" href="#defaultrouter" title="Permanent link">¶</a></h2>
|
||||
<h3 id="defaultrouter">DefaultRouter<a class="headerlink" href="#defaultrouter" title="Permanent link">¶</a></h3>
|
||||
<p>This router is similar to <code>SimpleRouter</code> as above, but additionally includes a default API root view, that returns a response containing hyperlinks to all the list views. It also generates routes for optional <code>.json</code> style format suffixes.</p>
|
||||
<table border=1>
|
||||
<tr><th>URL Style</th><th>HTTP Method</th><th>Action</th><th>URL Name</th></tr>
|
||||
|
|
@ -2858,7 +3210,7 @@ This behavior can be modified by setting the <code>trailing_slash</code> argumen
|
|||
<p>As with <code>SimpleRouter</code> the trailing slashes on the URL routes can be removed by setting the <code>trailing_slash</code> argument to <code>False</code> when instantiating the router.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>router = DefaultRouter(trailing_slash=False)
|
||||
</code></pre></div>
|
||||
<h1 id="custom-routers">Custom Routers<a class="headerlink" href="#custom-routers" title="Permanent link">¶</a></h1>
|
||||
<h2 id="custom-routers">Custom Routers<a class="headerlink" href="#custom-routers" title="Permanent link">¶</a></h2>
|
||||
<p>Implementing a custom router isn't something you'd need to do very often, but it can be useful if you have specific requirements about how the URLs for your API are structured. Doing so allows you to encapsulate the URL structure in a reusable way that ensures you don't have to write your URL patterns explicitly for each new view.</p>
|
||||
<p>The simplest way to implement a custom router is to subclass one of the existing router classes. The <code>.routes</code> attribute is used to template the URL patterns that will be mapped to each viewset. The <code>.routes</code> attribute is a list of <code>Route</code> named tuples.</p>
|
||||
<p>The arguments to the <code>Route</code> named tuple are:</p>
|
||||
|
|
@ -2874,7 +3226,7 @@ This behavior can be modified by setting the <code>trailing_slash</code> argumen
|
|||
<li><code>{basename}</code> - The base to use for the URL names that are created.</li>
|
||||
</ul>
|
||||
<p><strong>initkwargs</strong>: A dictionary of any additional arguments that should be passed when instantiating the view. Note that the <code>detail</code>, <code>basename</code>, and <code>suffix</code> arguments are reserved for viewset introspection and are also used by the browsable API to generate the view name and breadcrumb links.</p>
|
||||
<h2 id="customizing-dynamic-routes">Customizing dynamic routes<a class="headerlink" href="#customizing-dynamic-routes" title="Permanent link">¶</a></h2>
|
||||
<h3 id="customizing-dynamic-routes">Customizing dynamic routes<a class="headerlink" href="#customizing-dynamic-routes" title="Permanent link">¶</a></h3>
|
||||
<p>You can also customize how the <code>@action</code> decorator is routed. Include the <code>DynamicRoute</code> named tuple in the <code>.routes</code> list, setting the <code>detail</code> argument as appropriate for the list-based and detail-based routes. In addition to <code>detail</code>, the arguments to <code>DynamicRoute</code> are:</p>
|
||||
<p><strong>url</strong>: A string representing the URL to be routed. May include the same format strings as <code>Route</code>, and additionally accepts the <code>{url_path}</code> format string.</p>
|
||||
<p><strong>name</strong>: The name of the URL as used in <code>reverse</code> calls. May include the following format strings:</p>
|
||||
|
|
@ -2883,7 +3235,7 @@ This behavior can be modified by setting the <code>trailing_slash</code> argumen
|
|||
<li><code>{url_name}</code> - The <code>url_name</code> provided to the <code>@action</code>.</li>
|
||||
</ul>
|
||||
<p><strong>initkwargs</strong>: A dictionary of any additional arguments that should be passed when instantiating the view.</p>
|
||||
<h2 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h2>
|
||||
<h3 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h3>
|
||||
<p>The following example will only route to the <code>list</code> and <code>retrieve</code> actions, and does not use the trailing slash convention.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>from rest_framework.routers import Route, DynamicRoute, SimpleRouter
|
||||
|
||||
|
|
@ -2948,21 +3300,21 @@ urlpatterns = router.urls
|
|||
</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">Advanced custom routers<a class="headerlink" href="#advanced-custom-routers" title="Permanent link">¶</a></h2>
|
||||
<h3 id="advanced-custom-routers">Advanced custom routers<a class="headerlink" href="#advanced-custom-routers" title="Permanent link">¶</a></h3>
|
||||
<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_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">Third Party Packages<a class="headerlink" href="#third-party-packages" title="Permanent link">¶</a></h1>
|
||||
<h2 id="third-party-packages">Third Party Packages<a class="headerlink" href="#third-party-packages" title="Permanent link">¶</a></h2>
|
||||
<p>The following third party packages are also available.</p>
|
||||
<h2 id="drf-nested-routers">DRF Nested Routers<a class="headerlink" href="#drf-nested-routers" title="Permanent link">¶</a></h2>
|
||||
<h3 id="drf-nested-routers">DRF Nested Routers<a class="headerlink" href="#drf-nested-routers" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://github.com/alanjds/drf-nested-routers">drf-nested-routers package</a> provides routers and relationship fields for working with nested resources.</p>
|
||||
<h2 id="modelrouter-wqdbrest">ModelRouter (wq.db.rest)<a class="headerlink" href="#modelrouter-wqdbrest" title="Permanent link">¶</a></h2>
|
||||
<h3 id="modelrouter-wqdbrest">ModelRouter (wq.db.rest)<a class="headerlink" href="#modelrouter-wqdbrest" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://wq.io/wq.db">wq.db package</a> provides an advanced <a href="https://wq.io/docs/router">ModelRouter</a> class (and singleton instance) that extends <code>DefaultRouter</code> with a <code>register_model()</code> API. Much like Django's <code>admin.site.register</code>, the only required argument to <code>rest.router.register_model</code> is a model class. Reasonable defaults for a url prefix, serializer, and viewset will be inferred from the model and global configuration.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>from wq.db import rest
|
||||
from myapp.models import MyModel
|
||||
|
||||
rest.router.register_model(MyModel)
|
||||
</code></pre></div>
|
||||
<h2 id="drf-extensions">DRF-extensions<a class="headerlink" href="#drf-extensions" title="Permanent link">¶</a></h2>
|
||||
<h3 id="drf-extensions">DRF-extensions<a class="headerlink" href="#drf-extensions" title="Permanent link">¶</a></h3>
|
||||
<p>The <a href="https://chibisov.github.io/drf-extensions/docs/"><code>DRF-extensions</code> package</a> provides <a href="https://chibisov.github.io/drf-extensions/docs/#routers">routers</a> for creating <a href="https://chibisov.github.io/drf-extensions/docs/#nested-routes">nested viewsets</a>, <a href="https://chibisov.github.io/drf-extensions/docs/#collection-level-controllers">collection level controllers</a> with <a href="https://chibisov.github.io/drf-extensions/docs/#controller-endpoint-name">customizable endpoint names</a>.</p>
|
||||
|
||||
|
||||
|
|
@ -3026,7 +3378,7 @@ rest.router.register_model(MyModel)
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2862,6 +2860,315 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#overview" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Overview
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#generating-an-openapi-schema" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Generating an OpenAPI Schema
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Generating an OpenAPI Schema">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#install-dependencies" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Install dependencies
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#generating-a-static-schema-with-the-generateschema-management-command" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Generating a static schema with the generateschema management command
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#generating-a-dynamic-schema-with-schemaview" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Generating a dynamic schema with SchemaView
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Generating a dynamic schema with SchemaView">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_schema_view" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
get_schema_view()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#schemagenerator" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
SchemaGenerator
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="SchemaGenerator">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_schemaself-requestnone-publicfalse" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
get_schema(self, request=None, public=False)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#autoschema" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
AutoSchema
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="AutoSchema">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#autoschema-methods" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
AutoSchema methods
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="AutoSchema methods">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_components" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
get_components()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_component_name" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
get_component_name()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_reference" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
get_reference()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#map_serializer" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
map_serializer()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#map_field" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
map_field()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_tags" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
get_tags()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_operation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
get_operation()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_operation_id" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
get_operation_id()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_operation_id_base" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
get_operation_id_base()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_serializer" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
get_serializer()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_request_serializer" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
get_request_serializer()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_response_serializer" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
get_response_serializer()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#autoschema__init__-kwargs" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
AutoSchema.__init__() kwargs
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -3335,7 +3642,7 @@ create a base <code>AutoSchema</code> subclass for your project that takes addit
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2645,6 +2643,98 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#informational-1xx" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Informational - 1xx
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#successful-2xx" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Successful - 2xx
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#redirection-3xx" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Redirection - 3xx
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#client-error-4xx" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Client Error - 4xx
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#server-error-5xx" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Server Error - 5xx
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#helper-functions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Helper functions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2880,7 +2970,7 @@ is_server_error() # 5xx
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -1259,6 +1257,84 @@
|
|||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-reference" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Reference
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Reference">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#anonratethrottle" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
AnonRateThrottle
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#userratethrottle" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
UserRateThrottle
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#scopedratethrottle" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ScopedRateThrottle
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-throttles" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom throttles
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom throttles">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -2634,6 +2710,165 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#how-throttling-is-determined" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
How throttling is determined
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setting-the-throttling-policy" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setting the throttling policy
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#how-clients-are-identified" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
How clients are identified
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setting-up-the-cache" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setting up the cache
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#a-note-on-concurrency" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
A note on concurrency
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-reference" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Reference
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Reference">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#anonratethrottle" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
AnonRateThrottle
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#userratethrottle" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
UserRateThrottle
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#scopedratethrottle" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ScopedRateThrottle
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-throttles" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom throttles
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom throttles">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2776,8 +3011,8 @@ class CustomAnonRateThrottle(AnonRateThrottle):
|
|||
<p>The built-in throttle implementations are open to <a href="https://en.wikipedia.org/wiki/Race_condition#Data_race">race conditions</a>, so under high concurrency they may allow a few extra requests through.</p>
|
||||
<p>If your project relies on guaranteeing the number of requests during concurrent requests, you will need to implement your own throttle class. See <a href="https://github.com/encode/django-rest-framework/issues/5181">issue #5181</a> for more details.</p>
|
||||
<hr />
|
||||
<h1 id="api-reference">API Reference<a class="headerlink" href="#api-reference" title="Permanent link">¶</a></h1>
|
||||
<h2 id="anonratethrottle">AnonRateThrottle<a class="headerlink" href="#anonratethrottle" title="Permanent link">¶</a></h2>
|
||||
<h2 id="api-reference">API Reference<a class="headerlink" href="#api-reference" title="Permanent link">¶</a></h2>
|
||||
<h3 id="anonratethrottle">AnonRateThrottle<a class="headerlink" href="#anonratethrottle" title="Permanent link">¶</a></h3>
|
||||
<p>The <code>AnonRateThrottle</code> will only ever throttle unauthenticated users. The IP address of the incoming request is used to generate a unique key to throttle against.</p>
|
||||
<p>The allowed request rate is determined from one of the following (in order of preference).</p>
|
||||
<ul>
|
||||
|
|
@ -2785,7 +3020,7 @@ class CustomAnonRateThrottle(AnonRateThrottle):
|
|||
<li>The <code>DEFAULT_THROTTLE_RATES['anon']</code> setting.</li>
|
||||
</ul>
|
||||
<p><code>AnonRateThrottle</code> is suitable if you want to restrict the rate of requests from unknown sources.</p>
|
||||
<h2 id="userratethrottle">UserRateThrottle<a class="headerlink" href="#userratethrottle" title="Permanent link">¶</a></h2>
|
||||
<h3 id="userratethrottle">UserRateThrottle<a class="headerlink" href="#userratethrottle" title="Permanent link">¶</a></h3>
|
||||
<p>The <code>UserRateThrottle</code> will throttle users to a given rate of requests across the API. The user id is used to generate a unique key to throttle against. Unauthenticated requests will fall back to using the IP address of the incoming request to generate a unique key to throttle against.</p>
|
||||
<p>The allowed request rate is determined from one of the following (in order of preference).</p>
|
||||
<ul>
|
||||
|
|
@ -2813,7 +3048,7 @@ class SustainedRateThrottle(UserRateThrottle):
|
|||
}
|
||||
</code></pre></div>
|
||||
<p><code>UserRateThrottle</code> is suitable if you want simple global rate restrictions per-user.</p>
|
||||
<h2 id="scopedratethrottle">ScopedRateThrottle<a class="headerlink" href="#scopedratethrottle" title="Permanent link">¶</a></h2>
|
||||
<h3 id="scopedratethrottle">ScopedRateThrottle<a class="headerlink" href="#scopedratethrottle" title="Permanent link">¶</a></h3>
|
||||
<p>The <code>ScopedRateThrottle</code> class can be used to restrict access to specific parts of the API. This throttle will only be applied if the view that is being accessed includes a <code>.throttle_scope</code> property. The unique throttle key will then be formed by concatenating the "scope" of the request with the unique user id or IP address.</p>
|
||||
<p>The allowed request rate is determined by the <code>DEFAULT_THROTTLE_RATES</code> setting using a key from the request "scope".</p>
|
||||
<p>For example, given the following views...</p>
|
||||
|
|
@ -2842,11 +3077,11 @@ class UploadView(APIView):
|
|||
</code></pre></div>
|
||||
<p>User requests to either <code>ContactListView</code> or <code>ContactDetailView</code> would be restricted to a total of 1000 requests per-day. User requests to <code>UploadView</code> would be restricted to 20 requests per day.</p>
|
||||
<hr />
|
||||
<h1 id="custom-throttles">Custom throttles<a class="headerlink" href="#custom-throttles" title="Permanent link">¶</a></h1>
|
||||
<h2 id="custom-throttles">Custom throttles<a class="headerlink" href="#custom-throttles" title="Permanent link">¶</a></h2>
|
||||
<p>To create a custom throttle, override <code>BaseThrottle</code> and implement <code>.allow_request(self, request, view)</code>. The method should return <code>True</code> if the request should be allowed, and <code>False</code> otherwise.</p>
|
||||
<p>Optionally you may also override the <code>.wait()</code> method. If implemented, <code>.wait()</code> should return a recommended number of seconds to wait before attempting the next request, or <code>None</code>. The <code>.wait()</code> method will only be called if <code>.allow_request()</code> has previously returned <code>False</code>.</p>
|
||||
<p>If the <code>.wait()</code> method is implemented and the request is throttled, then a <code>Retry-After</code> header will be included in the response.</p>
|
||||
<h2 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h2>
|
||||
<h3 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h3>
|
||||
<p>The following is an example of a rate throttle, that will randomly throttle 1 in every 10 requests.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>import random
|
||||
|
||||
|
|
@ -2916,7 +3151,7 @@ class RandomRateThrottle(throttling.BaseThrottle):
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -1214,6 +1212,168 @@
|
|||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#advanced-field-defaults" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Advanced field defaults
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Advanced field defaults">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#currentuserdefault" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
CurrentUserDefault
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#createonlydefault" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
CreateOnlyDefault
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#limitations-of-validators" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Limitations of validators
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Limitations of validators">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#optional-fields" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Optional fields
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#updating-nested-serializers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Updating nested serializers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#debugging-complex-cases" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Debugging complex cases
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#writing-custom-validators" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Writing custom validators
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Writing custom validators">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#function-based" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Function based
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Function based">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#field-level-validation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Field-level validation
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#class-based" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Class-based
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Class-based">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#accessing-the-context" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Accessing the context
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -2701,6 +2861,316 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#validation-in-rest-framework" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Validation in REST framework
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Validation in REST framework">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#uniquevalidator" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
UniqueValidator
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#uniquetogethervalidator" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
UniqueTogetherValidator
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#uniquefordatevalidator" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
UniqueForDateValidator
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#uniqueformonthvalidator" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
UniqueForMonthValidator
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#uniqueforyearvalidator" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
UniqueForYearValidator
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="UniqueForYearValidator">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-with-a-writable-date-field" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using with a writable date field.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-with-a-read-only-date-field" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using with a read-only date field.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-with-a-hidden-date-field" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using with a hidden date field.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#advanced-field-defaults" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Advanced field defaults
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Advanced field defaults">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#currentuserdefault" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
CurrentUserDefault
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#createonlydefault" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
CreateOnlyDefault
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#limitations-of-validators" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Limitations of validators
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Limitations of validators">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#optional-fields" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Optional fields
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#updating-nested-serializers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Updating nested serializers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#debugging-complex-cases" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Debugging complex cases
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#writing-custom-validators" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Writing custom validators
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Writing custom validators">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#function-based" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Function based
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Function based">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#field-level-validation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Field-level validation
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#class-based" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Class-based
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Class-based">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#accessing-the-context" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Accessing the context
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2778,7 +3248,7 @@
|
|||
<li>Printing the <code>repr</code> of a serializer instance will show you exactly what validation rules it applies. There's no extra hidden validation behavior being called on the model instance.</li>
|
||||
</ul>
|
||||
<p>When you're using <code>ModelSerializer</code> all of this is handled automatically for you. If you want to drop down to using <code>Serializer</code> classes instead, then you need to define the validation rules explicitly.</p>
|
||||
<h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h4>
|
||||
<h3 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h3>
|
||||
<p>As an example of how REST framework uses explicit validation, we'll take a simple model class that has a field with a uniqueness constraint.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class CustomerReportRecord(models.Model):
|
||||
time_raised = models.DateTimeField(default=timezone.now, editable=False)
|
||||
|
|
@ -2874,15 +3344,15 @@ class ExampleSerializer(serializers.Serializer):
|
|||
</code></pre></div>
|
||||
<p>The date field that is used for the validation is always required to be present on the serializer class. You can't simply rely on a model class <code>default=...</code>, because the value being used for the default wouldn't be generated until after the validation has run.</p>
|
||||
<p>There are a couple of styles you may want to use for this depending on how you want your API to behave. If you're using <code>ModelSerializer</code> you'll probably simply rely on the defaults that REST framework generates for you, but if you are using <code>Serializer</code> or simply want more explicit control, use on of the styles demonstrated below.</p>
|
||||
<h4 id="using-with-a-writable-date-field">Using with a writable date field.<a class="headerlink" href="#using-with-a-writable-date-field" title="Permanent link">¶</a></h4>
|
||||
<h3 id="using-with-a-writable-date-field">Using with a writable date field.<a class="headerlink" href="#using-with-a-writable-date-field" title="Permanent link">¶</a></h3>
|
||||
<p>If you want the date field to be writable the only thing worth noting is that you should ensure that it is always available in the input data, either by setting a <code>default</code> argument, or by setting <code>required=True</code>.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>published = serializers.DateTimeField(required=True)
|
||||
</code></pre></div>
|
||||
<h4 id="using-with-a-read-only-date-field">Using with a read-only date field.<a class="headerlink" href="#using-with-a-read-only-date-field" title="Permanent link">¶</a></h4>
|
||||
<h3 id="using-with-a-read-only-date-field">Using with a read-only date field.<a class="headerlink" href="#using-with-a-read-only-date-field" title="Permanent link">¶</a></h3>
|
||||
<p>If you want the date field to be visible, but not editable by the user, then set <code>read_only=True</code> and additionally set a <code>default=...</code> argument.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>published = serializers.DateTimeField(read_only=True, default=timezone.now)
|
||||
</code></pre></div>
|
||||
<h4 id="using-with-a-hidden-date-field">Using with a hidden date field.<a class="headerlink" href="#using-with-a-hidden-date-field" title="Permanent link">¶</a></h4>
|
||||
<h3 id="using-with-a-hidden-date-field">Using with a hidden date field.<a class="headerlink" href="#using-with-a-hidden-date-field" title="Permanent link">¶</a></h3>
|
||||
<p>If you want the date field to be entirely hidden from the user, then use <code>HiddenField</code>. This field type does not accept user input, but instead always returns its default value to the <code>validated_data</code> in the serializer.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>published = serializers.HiddenField(default=timezone.now)
|
||||
</code></pre></div>
|
||||
|
|
@ -2894,7 +3364,7 @@ class ExampleSerializer(serializers.Serializer):
|
|||
<p class="admonition-title">Note</p>
|
||||
<p><code>HiddenField()</code> does not appear in <code>partial=True</code> serializer (when making <code>PATCH</code> request). </p>
|
||||
</div>
|
||||
<h1 id="advanced-field-defaults">Advanced field defaults<a class="headerlink" href="#advanced-field-defaults" title="Permanent link">¶</a></h1>
|
||||
<h2 id="advanced-field-defaults">Advanced field defaults<a class="headerlink" href="#advanced-field-defaults" title="Permanent link">¶</a></h2>
|
||||
<p>Validators that are applied across multiple fields in the serializer can sometimes require a field input that should not be provided by the API client, but that <em>is</em> available as input to the validator.
|
||||
For this purposes use <code>HiddenField</code>. This field will be present in <code>validated_data</code> but <em>will not</em> be used in the serializer output representation.</p>
|
||||
<div class="admonition note">
|
||||
|
|
@ -2902,13 +3372,13 @@ For this purposes use <code>HiddenField</code>. This field will be present in <c
|
|||
<p>Using a <code>read_only=True</code> field is excluded from writable fields so it won't use a <code>default=…</code> argument. Look <a href="https://www.django-rest-framework.org/community/3.8-announcement/#altered-the-behavior-of-read_only-plus-default-on-field">3.8 announcement</a>.</p>
|
||||
</div>
|
||||
<p>REST framework includes a couple of defaults that may be useful in this context.</p>
|
||||
<h4 id="currentuserdefault">CurrentUserDefault<a class="headerlink" href="#currentuserdefault" title="Permanent link">¶</a></h4>
|
||||
<h3 id="currentuserdefault">CurrentUserDefault<a class="headerlink" href="#currentuserdefault" title="Permanent link">¶</a></h3>
|
||||
<p>A default class that can be used to represent the current user. In order to use this, the 'request' must have been provided as part of the context dictionary when instantiating the serializer.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>owner = serializers.HiddenField(
|
||||
default=serializers.CurrentUserDefault()
|
||||
)
|
||||
</code></pre></div>
|
||||
<h4 id="createonlydefault">CreateOnlyDefault<a class="headerlink" href="#createonlydefault" title="Permanent link">¶</a></h4>
|
||||
<h3 id="createonlydefault">CreateOnlyDefault<a class="headerlink" href="#createonlydefault" title="Permanent link">¶</a></h3>
|
||||
<p>A default class that can be used to <em>only set a default argument during create operations</em>. During updates the field is omitted.</p>
|
||||
<p>It takes a single argument, which is the default value or callable that should be used during create operations.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>created_at = serializers.DateTimeField(
|
||||
|
|
@ -2916,13 +3386,13 @@ For this purposes use <code>HiddenField</code>. This field will be present in <c
|
|||
)
|
||||
</code></pre></div>
|
||||
<hr />
|
||||
<h1 id="limitations-of-validators">Limitations of validators<a class="headerlink" href="#limitations-of-validators" title="Permanent link">¶</a></h1>
|
||||
<h2 id="limitations-of-validators">Limitations of validators<a class="headerlink" href="#limitations-of-validators" title="Permanent link">¶</a></h2>
|
||||
<p>There are some ambiguous cases where you'll need to instead handle validation
|
||||
explicitly, rather than relying on the default serializer classes that
|
||||
<code>ModelSerializer</code> generates.</p>
|
||||
<p>In these cases you may want to disable the automatically generated validators,
|
||||
by specifying an empty list for the serializer <code>Meta.validators</code> attribute.</p>
|
||||
<h2 id="optional-fields">Optional fields<a class="headerlink" href="#optional-fields" title="Permanent link">¶</a></h2>
|
||||
<h3 id="optional-fields">Optional fields<a class="headerlink" href="#optional-fields" title="Permanent link">¶</a></h3>
|
||||
<p>By default "unique together" validation enforces that all fields be
|
||||
<code>required=True</code>. In some cases, you might want to explicit apply
|
||||
<code>required=False</code> to one of the fields, in which case the desired behavior
|
||||
|
|
@ -2940,7 +3410,7 @@ in the <code>.validate()</code> method, or else in the view.</p>
|
|||
extra_kwargs = {'client': {'required': False}}
|
||||
validators = [] # Remove a default "unique together" constraint.
|
||||
</code></pre></div>
|
||||
<h2 id="updating-nested-serializers">Updating nested serializers<a class="headerlink" href="#updating-nested-serializers" title="Permanent link">¶</a></h2>
|
||||
<h3 id="updating-nested-serializers">Updating nested serializers<a class="headerlink" href="#updating-nested-serializers" title="Permanent link">¶</a></h3>
|
||||
<p>When applying an update to an existing instance, uniqueness validators will
|
||||
exclude the current instance from the uniqueness check. The current instance
|
||||
is available in the context of the uniqueness check, because it exists as
|
||||
|
|
@ -2951,7 +3421,7 @@ applying this exclusion, because the instance is not available.</p>
|
|||
<p>Again, you'll probably want to explicitly remove the validator from the
|
||||
serializer class, and write the code for the validation constraint
|
||||
explicitly, in a <code>.validate()</code> method, or in the view.</p>
|
||||
<h2 id="debugging-complex-cases">Debugging complex cases<a class="headerlink" href="#debugging-complex-cases" title="Permanent link">¶</a></h2>
|
||||
<h3 id="debugging-complex-cases">Debugging complex cases<a class="headerlink" href="#debugging-complex-cases" title="Permanent link">¶</a></h3>
|
||||
<p>If you're not sure exactly what behavior a <code>ModelSerializer</code> class will
|
||||
generate it is usually a good idea to run <code>manage.py shell</code>, and print
|
||||
an instance of the serializer, so that you can inspect the fields and
|
||||
|
|
@ -2966,9 +3436,9 @@ define your serializer classes, rather than relying on the default
|
|||
<code>ModelSerializer</code> behavior. This involves a little more code, but ensures
|
||||
that the resulting behavior is more transparent.</p>
|
||||
<hr />
|
||||
<h1 id="writing-custom-validators">Writing custom validators<a class="headerlink" href="#writing-custom-validators" title="Permanent link">¶</a></h1>
|
||||
<h2 id="writing-custom-validators">Writing custom validators<a class="headerlink" href="#writing-custom-validators" title="Permanent link">¶</a></h2>
|
||||
<p>You can use any of Django's existing validators, or write your own custom validators.</p>
|
||||
<h2 id="function-based">Function based<a class="headerlink" href="#function-based" title="Permanent link">¶</a></h2>
|
||||
<h3 id="function-based">Function based<a class="headerlink" href="#function-based" title="Permanent link">¶</a></h3>
|
||||
<p>A validator may be any callable that raises a <code>serializers.ValidationError</code> on failure.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>def even_number(value):
|
||||
if value % 2 != 0:
|
||||
|
|
@ -2978,7 +3448,7 @@ that the resulting behavior is more transparent.</p>
|
|||
<p>You can specify custom field-level validation by adding <code>.validate_<field_name></code> methods
|
||||
to your <code>Serializer</code> subclass. This is documented in the
|
||||
<a href="https://www.django-rest-framework.org/api-guide/serializers/#field-level-validation">Serializer docs</a></p>
|
||||
<h2 id="class-based">Class-based<a class="headerlink" href="#class-based" title="Permanent link">¶</a></h2>
|
||||
<h3 id="class-based">Class-based<a class="headerlink" href="#class-based" title="Permanent link">¶</a></h3>
|
||||
<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>
|
||||
<div class="language-text highlight"><pre><span></span><code>class MultipleOf:
|
||||
def __init__(self, base):
|
||||
|
|
@ -3063,7 +3533,7 @@ or <code>serializer</code> as an additional argument.</p>
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -1366,6 +1364,123 @@
|
|||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-reference" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Reference
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Reference">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#acceptheaderversioning" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
AcceptHeaderVersioning
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="AcceptHeaderVersioning">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-accept-headers-with-vendor-media-types" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using accept headers with vendor media types
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#urlpathversioning" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
URLPathVersioning
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#namespaceversioning" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
NamespaceVersioning
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#hostnameversioning" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
HostNameVersioning
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#queryparameterversioning" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
QueryParameterVersioning
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-versioning-schemes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom versioning schemes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom versioning schemes">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -2657,6 +2772,227 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#versioning-with-rest-framework" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Versioning with REST framework
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Versioning with REST framework">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#varying-behavior-based-on-the-version" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Varying behavior based on the version
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#reversing-urls-for-versioned-apis" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Reversing URLs for versioned APIs
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#versioned-apis-and-hyperlinked-serializers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Versioned APIs and hyperlinked serializers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#configuring-the-versioning-scheme" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Configuring the versioning scheme
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Configuring the versioning scheme">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#other-versioning-settings" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Other versioning settings
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-reference" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Reference
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Reference">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#acceptheaderversioning" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
AcceptHeaderVersioning
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="AcceptHeaderVersioning">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-accept-headers-with-vendor-media-types" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using accept headers with vendor media types
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#urlpathversioning" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
URLPathVersioning
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#namespaceversioning" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
NamespaceVersioning
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#hostnameversioning" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
HostNameVersioning
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#queryparameterversioning" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
QueryParameterVersioning
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-versioning-schemes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom versioning schemes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom versioning schemes">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2729,14 +3065,14 @@
|
|||
<h2 id="versioning-with-rest-framework">Versioning with REST framework<a class="headerlink" href="#versioning-with-rest-framework" title="Permanent link">¶</a></h2>
|
||||
<p>When API versioning is enabled, the <code>request.version</code> attribute will contain a string that corresponds to the version requested in the incoming client request.</p>
|
||||
<p>By default, versioning is not enabled, and <code>request.version</code> will always return <code>None</code>.</p>
|
||||
<h4 id="varying-behavior-based-on-the-version">Varying behavior based on the version<a class="headerlink" href="#varying-behavior-based-on-the-version" title="Permanent link">¶</a></h4>
|
||||
<h3 id="varying-behavior-based-on-the-version">Varying behavior based on the version<a class="headerlink" href="#varying-behavior-based-on-the-version" title="Permanent link">¶</a></h3>
|
||||
<p>How you vary the API behavior is up to you, but one example you might typically want is to switch to a different serialization style in a newer version. For example:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>def get_serializer_class(self):
|
||||
if self.request.version == 'v1':
|
||||
return AccountSerializerVersion1
|
||||
return AccountSerializer
|
||||
</code></pre></div>
|
||||
<h4 id="reversing-urls-for-versioned-apis">Reversing URLs for versioned APIs<a class="headerlink" href="#reversing-urls-for-versioned-apis" title="Permanent link">¶</a></h4>
|
||||
<h3 id="reversing-urls-for-versioned-apis">Reversing URLs for versioned APIs<a class="headerlink" href="#reversing-urls-for-versioned-apis" title="Permanent link">¶</a></h3>
|
||||
<p>The <code>reverse</code> function included by REST framework ties in with the versioning scheme. You need to make sure to include the current <code>request</code> as a keyword argument, like so.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>from rest_framework.reverse import reverse
|
||||
|
||||
|
|
@ -2747,7 +3083,7 @@ reverse('bookings-list', request=request)
|
|||
<li>If <code>NamespaceVersioning</code> was being used, and the API version was 'v1', then the URL lookup used would be <code>'v1:bookings-list'</code>, which might resolve to a URL like <code>http://example.org/v1/bookings/</code>.</li>
|
||||
<li>If <code>QueryParameterVersioning</code> was being used, and the API version was <code>1.0</code>, then the returned URL might be something like <code>http://example.org/bookings/?version=1.0</code></li>
|
||||
</ul>
|
||||
<h4 id="versioned-apis-and-hyperlinked-serializers">Versioned APIs and hyperlinked serializers<a class="headerlink" href="#versioned-apis-and-hyperlinked-serializers" title="Permanent link">¶</a></h4>
|
||||
<h3 id="versioned-apis-and-hyperlinked-serializers">Versioned APIs and hyperlinked serializers<a class="headerlink" href="#versioned-apis-and-hyperlinked-serializers" title="Permanent link">¶</a></h3>
|
||||
<p>When using hyperlinked serialization styles together with a URL based versioning scheme make sure to include the request as context to the serializer.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>def get(self, request):
|
||||
queryset = Booking.objects.all()
|
||||
|
|
@ -2766,7 +3102,7 @@ reverse('bookings-list', request=request)
|
|||
<div class="language-text highlight"><pre><span></span><code>class ProfileList(APIView):
|
||||
versioning_class = versioning.QueryParameterVersioning
|
||||
</code></pre></div>
|
||||
<h4 id="other-versioning-settings">Other versioning settings<a class="headerlink" href="#other-versioning-settings" title="Permanent link">¶</a></h4>
|
||||
<h3 id="other-versioning-settings">Other versioning settings<a class="headerlink" href="#other-versioning-settings" title="Permanent link">¶</a></h3>
|
||||
<p>The following settings keys are also used to control versioning:</p>
|
||||
<ul>
|
||||
<li><code>DEFAULT_VERSION</code>. The value that should be used for <code>request.version</code> when no versioning information is present. Defaults to <code>None</code>.</li>
|
||||
|
|
@ -2786,8 +3122,8 @@ class ExampleView(APIVIew):
|
|||
versioning_class = ExampleVersioning
|
||||
</code></pre></div>
|
||||
<hr />
|
||||
<h1 id="api-reference">API Reference<a class="headerlink" href="#api-reference" title="Permanent link">¶</a></h1>
|
||||
<h2 id="acceptheaderversioning">AcceptHeaderVersioning<a class="headerlink" href="#acceptheaderversioning" title="Permanent link">¶</a></h2>
|
||||
<h2 id="api-reference">API Reference<a class="headerlink" href="#api-reference" title="Permanent link">¶</a></h2>
|
||||
<h3 id="acceptheaderversioning">AcceptHeaderVersioning<a class="headerlink" href="#acceptheaderversioning" title="Permanent link">¶</a></h3>
|
||||
<p>This scheme requires the client to specify the version as part of the media type in the <code>Accept</code> header. The version is included as a media type parameter, that supplements the main media type.</p>
|
||||
<p>Here's an example HTTP request using the accept header versioning style.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>GET /bookings/ HTTP/1.1
|
||||
|
|
@ -2806,7 +3142,7 @@ Accept: application/json; version=1.0
|
|||
Host: example.com
|
||||
Accept: application/vnd.megacorp.bookings+json; version=1.0
|
||||
</code></pre></div>
|
||||
<h2 id="urlpathversioning">URLPathVersioning<a class="headerlink" href="#urlpathversioning" title="Permanent link">¶</a></h2>
|
||||
<h3 id="urlpathversioning">URLPathVersioning<a class="headerlink" href="#urlpathversioning" title="Permanent link">¶</a></h3>
|
||||
<p>This scheme requires the client to specify the version as part of the URL path.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>GET /v1/bookings/ HTTP/1.1
|
||||
Host: example.com
|
||||
|
|
@ -2826,7 +3162,7 @@ Accept: application/json
|
|||
)
|
||||
]
|
||||
</code></pre></div>
|
||||
<h2 id="namespaceversioning">NamespaceVersioning<a class="headerlink" href="#namespaceversioning" title="Permanent link">¶</a></h2>
|
||||
<h3 id="namespaceversioning">NamespaceVersioning<a class="headerlink" href="#namespaceversioning" title="Permanent link">¶</a></h3>
|
||||
<p>To the client, this scheme is the same as <code>URLPathVersioning</code>. The only difference is how it is configured in your Django application, as it uses URL namespacing, instead of URL keyword arguments.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>GET /v1/something/ HTTP/1.1
|
||||
Host: example.com
|
||||
|
|
@ -2847,7 +3183,7 @@ urlpatterns = [
|
|||
]
|
||||
</code></pre></div>
|
||||
<p>Both <code>URLPathVersioning</code> and <code>NamespaceVersioning</code> are reasonable if you just need a simple versioning scheme. The <code>URLPathVersioning</code> approach might be better suitable for small ad-hoc projects, and the <code>NamespaceVersioning</code> is probably easier to manage for larger projects.</p>
|
||||
<h2 id="hostnameversioning">HostNameVersioning<a class="headerlink" href="#hostnameversioning" title="Permanent link">¶</a></h2>
|
||||
<h3 id="hostnameversioning">HostNameVersioning<a class="headerlink" href="#hostnameversioning" title="Permanent link">¶</a></h3>
|
||||
<p>The hostname versioning scheme requires the client to specify the requested version as part of the hostname in the URL.</p>
|
||||
<p>For example the following is an HTTP request to the <code>http://v1.example.com/bookings/</code> URL:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>GET /bookings/ HTTP/1.1
|
||||
|
|
@ -2860,16 +3196,16 @@ Accept: application/json
|
|||
<p>Note that the first group is enclosed in brackets, indicating that this is the matched portion of the hostname.</p>
|
||||
<p>The <code>HostNameVersioning</code> scheme can be awkward to use in debug mode as you will typically be accessing a raw IP address such as <code>127.0.0.1</code>. There are various online tutorials on how to <a href="https://reinteractive.net/posts/199-developing-and-testing-rails-applications-with-subdomains">access localhost with a custom subdomain</a> which you may find helpful in this case.</p>
|
||||
<p>Hostname based versioning can be particularly useful if you have requirements to route incoming requests to different servers based on the version, as you can configure different DNS records for different API versions.</p>
|
||||
<h2 id="queryparameterversioning">QueryParameterVersioning<a class="headerlink" href="#queryparameterversioning" title="Permanent link">¶</a></h2>
|
||||
<h3 id="queryparameterversioning">QueryParameterVersioning<a class="headerlink" href="#queryparameterversioning" title="Permanent link">¶</a></h3>
|
||||
<p>This scheme is a simple style that includes the version as a query parameter in the URL. For example:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>GET /something/?version=0.1 HTTP/1.1
|
||||
Host: example.com
|
||||
Accept: application/json
|
||||
</code></pre></div>
|
||||
<hr />
|
||||
<h1 id="custom-versioning-schemes">Custom versioning schemes<a class="headerlink" href="#custom-versioning-schemes" title="Permanent link">¶</a></h1>
|
||||
<h2 id="custom-versioning-schemes">Custom versioning schemes<a class="headerlink" href="#custom-versioning-schemes" title="Permanent link">¶</a></h2>
|
||||
<p>To implement a custom versioning scheme, subclass <code>BaseVersioning</code> and override the <code>.determine_version</code> method.</p>
|
||||
<h2 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h2>
|
||||
<h3 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h3>
|
||||
<p>The following example uses a custom <code>X-API-Version</code> header to determine the requested version.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>class XAPIVersionScheme(versioning.BaseVersioning):
|
||||
def determine_version(self, request, *args, **kwargs):
|
||||
|
|
@ -2938,7 +3274,7 @@ Accept: application/json
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -789,8 +787,6 @@
|
|||
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||
|
||||
|
|
@ -833,8 +829,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
|
|
@ -843,6 +837,18 @@
|
|||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#class-based-views" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Class-based Views
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Class-based Views">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-policy-attributes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
|
|
@ -924,8 +930,8 @@
|
|||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-policy-instantiation-methods" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
|
|
@ -1018,8 +1024,8 @@
|
|||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-policy-implementation-methods" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
|
|
@ -1068,8 +1074,8 @@
|
|||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#dispatch-methods" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
|
|
@ -1128,6 +1134,61 @@
|
|||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#function-based-views" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Function Based Views
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Function Based Views">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api_view" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
@api_view()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-policy-decorators" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API policy decorators
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#view-schema-decorator" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
View schema decorator
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -2867,6 +2928,385 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#class-based-views" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Class-based Views
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Class-based Views">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-policy-attributes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API policy attributes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API policy attributes">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#renderer_classes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.renderer_classes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#parser_classes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.parser_classes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#authentication_classes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.authentication_classes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#throttle_classes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.throttle_classes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#permission_classes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.permission_classes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#content_negotiation_class" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.content_negotiation_class
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-policy-instantiation-methods" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API policy instantiation methods
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API policy instantiation methods">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_renderersself" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.get_renderers(self)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_parsersself" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.get_parsers(self)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_authenticatorsself" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.get_authenticators(self)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_throttlesself" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.get_throttles(self)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_permissionsself" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.get_permissions(self)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_content_negotiatorself" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.get_content_negotiator(self)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#get_exception_handlerself" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.get_exception_handler(self)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-policy-implementation-methods" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API policy implementation methods
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API policy implementation methods">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#check_permissionsself-request" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.check_permissions(self, request)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#check_throttlesself-request" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.check_throttles(self, request)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#perform_content_negotiationself-request-forcefalse" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.perform_content_negotiation(self, request, force=False)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#dispatch-methods" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Dispatch methods
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Dispatch methods">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#initialself-request-args-kwargs" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.initial(self, request, *args, **kwargs)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#handle_exceptionself-exc" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.handle_exception(self, exc)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#initialize_requestself-request-args-kwargs" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.initialize_request(self, request, *args, **kwargs)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#finalize_responseself-request-response-args-kwargs" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
.finalize_response(self, request, response, *args, **kwargs)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#function-based-views" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Function Based Views
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Function Based Views">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api_view" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
@api_view()
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-policy-decorators" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API policy decorators
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#view-schema-decorator" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
View schema decorator
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2928,7 +3368,9 @@
|
|||
|
||||
|
||||
|
||||
<h1 id="class-based-views">Class-based Views<a class="headerlink" href="#class-based-views" title="Permanent link">¶</a></h1>
|
||||
<h1>Views</h1>
|
||||
|
||||
<h2 id="class-based-views">Class-based Views<a class="headerlink" href="#class-based-views" title="Permanent link">¶</a></h2>
|
||||
<blockquote>
|
||||
<p>Django's class-based views are a welcome departure from the old-style views.</p>
|
||||
<p>— <a href="https://reinout.vanrees.org/weblog/2011/08/24/class-based-views-usage.html">Reinout van Rees</a></p>
|
||||
|
|
@ -2969,53 +3411,53 @@ class ListUsers(APIView):
|
|||
<p class="admonition-title">Note</p>
|
||||
<p>The full methods, attributes on, and relations between Django REST Framework's <code>APIView</code>, <code>GenericAPIView</code>, various <code>Mixins</code>, and <code>Viewsets</code> can be initially complex. In addition to the documentation here, the <a href="http://www.cdrf.co">Classy Django REST Framework</a> resource provides a browsable reference, with full methods and attributes, for each of Django REST Framework's class-based views.</p>
|
||||
</div>
|
||||
<h2 id="api-policy-attributes">API policy attributes<a class="headerlink" href="#api-policy-attributes" title="Permanent link">¶</a></h2>
|
||||
<h3 id="api-policy-attributes">API policy attributes<a class="headerlink" href="#api-policy-attributes" title="Permanent link">¶</a></h3>
|
||||
<p>The following attributes control the pluggable aspects of API views.</p>
|
||||
<h3 id="renderer_classes">.renderer_classes<a class="headerlink" href="#renderer_classes" title="Permanent link">¶</a></h3>
|
||||
<h3 id="parser_classes">.parser_classes<a class="headerlink" href="#parser_classes" title="Permanent link">¶</a></h3>
|
||||
<h3 id="authentication_classes">.authentication_classes<a class="headerlink" href="#authentication_classes" title="Permanent link">¶</a></h3>
|
||||
<h3 id="throttle_classes">.throttle_classes<a class="headerlink" href="#throttle_classes" title="Permanent link">¶</a></h3>
|
||||
<h3 id="permission_classes">.permission_classes<a class="headerlink" href="#permission_classes" title="Permanent link">¶</a></h3>
|
||||
<h3 id="content_negotiation_class">.content_negotiation_class<a class="headerlink" href="#content_negotiation_class" title="Permanent link">¶</a></h3>
|
||||
<h2 id="api-policy-instantiation-methods">API policy instantiation methods<a class="headerlink" href="#api-policy-instantiation-methods" title="Permanent link">¶</a></h2>
|
||||
<h4 id="renderer_classes">.renderer_classes<a class="headerlink" href="#renderer_classes" title="Permanent link">¶</a></h4>
|
||||
<h4 id="parser_classes">.parser_classes<a class="headerlink" href="#parser_classes" title="Permanent link">¶</a></h4>
|
||||
<h4 id="authentication_classes">.authentication_classes<a class="headerlink" href="#authentication_classes" title="Permanent link">¶</a></h4>
|
||||
<h4 id="throttle_classes">.throttle_classes<a class="headerlink" href="#throttle_classes" title="Permanent link">¶</a></h4>
|
||||
<h4 id="permission_classes">.permission_classes<a class="headerlink" href="#permission_classes" title="Permanent link">¶</a></h4>
|
||||
<h4 id="content_negotiation_class">.content_negotiation_class<a class="headerlink" href="#content_negotiation_class" title="Permanent link">¶</a></h4>
|
||||
<h3 id="api-policy-instantiation-methods">API policy instantiation methods<a class="headerlink" href="#api-policy-instantiation-methods" title="Permanent link">¶</a></h3>
|
||||
<p>The following methods are used by REST framework to instantiate the various pluggable API policies. You won't typically need to override these methods.</p>
|
||||
<h3 id="get_renderersself">.get_renderers(self)<a class="headerlink" href="#get_renderersself" title="Permanent link">¶</a></h3>
|
||||
<h3 id="get_parsersself">.get_parsers(self)<a class="headerlink" href="#get_parsersself" title="Permanent link">¶</a></h3>
|
||||
<h3 id="get_authenticatorsself">.get_authenticators(self)<a class="headerlink" href="#get_authenticatorsself" title="Permanent link">¶</a></h3>
|
||||
<h3 id="get_throttlesself">.get_throttles(self)<a class="headerlink" href="#get_throttlesself" title="Permanent link">¶</a></h3>
|
||||
<h3 id="get_permissionsself">.get_permissions(self)<a class="headerlink" href="#get_permissionsself" title="Permanent link">¶</a></h3>
|
||||
<h3 id="get_content_negotiatorself">.get_content_negotiator(self)<a class="headerlink" href="#get_content_negotiatorself" title="Permanent link">¶</a></h3>
|
||||
<h3 id="get_exception_handlerself">.get_exception_handler(self)<a class="headerlink" href="#get_exception_handlerself" title="Permanent link">¶</a></h3>
|
||||
<h2 id="api-policy-implementation-methods">API policy implementation methods<a class="headerlink" href="#api-policy-implementation-methods" title="Permanent link">¶</a></h2>
|
||||
<h4 id="get_renderersself">.get_renderers(self)<a class="headerlink" href="#get_renderersself" title="Permanent link">¶</a></h4>
|
||||
<h4 id="get_parsersself">.get_parsers(self)<a class="headerlink" href="#get_parsersself" title="Permanent link">¶</a></h4>
|
||||
<h4 id="get_authenticatorsself">.get_authenticators(self)<a class="headerlink" href="#get_authenticatorsself" title="Permanent link">¶</a></h4>
|
||||
<h4 id="get_throttlesself">.get_throttles(self)<a class="headerlink" href="#get_throttlesself" title="Permanent link">¶</a></h4>
|
||||
<h4 id="get_permissionsself">.get_permissions(self)<a class="headerlink" href="#get_permissionsself" title="Permanent link">¶</a></h4>
|
||||
<h4 id="get_content_negotiatorself">.get_content_negotiator(self)<a class="headerlink" href="#get_content_negotiatorself" title="Permanent link">¶</a></h4>
|
||||
<h4 id="get_exception_handlerself">.get_exception_handler(self)<a class="headerlink" href="#get_exception_handlerself" title="Permanent link">¶</a></h4>
|
||||
<h3 id="api-policy-implementation-methods">API policy implementation methods<a class="headerlink" href="#api-policy-implementation-methods" title="Permanent link">¶</a></h3>
|
||||
<p>The following methods are called before dispatching to the handler method.</p>
|
||||
<h3 id="check_permissionsself-request">.check_permissions(self, request)<a class="headerlink" href="#check_permissionsself-request" title="Permanent link">¶</a></h3>
|
||||
<h3 id="check_throttlesself-request">.check_throttles(self, request)<a class="headerlink" href="#check_throttlesself-request" title="Permanent link">¶</a></h3>
|
||||
<h3 id="perform_content_negotiationself-request-forcefalse">.perform_content_negotiation(self, request, force=False)<a class="headerlink" href="#perform_content_negotiationself-request-forcefalse" title="Permanent link">¶</a></h3>
|
||||
<h2 id="dispatch-methods">Dispatch methods<a class="headerlink" href="#dispatch-methods" title="Permanent link">¶</a></h2>
|
||||
<h4 id="check_permissionsself-request">.check_permissions(self, request)<a class="headerlink" href="#check_permissionsself-request" title="Permanent link">¶</a></h4>
|
||||
<h4 id="check_throttlesself-request">.check_throttles(self, request)<a class="headerlink" href="#check_throttlesself-request" title="Permanent link">¶</a></h4>
|
||||
<h4 id="perform_content_negotiationself-request-forcefalse">.perform_content_negotiation(self, request, force=False)<a class="headerlink" href="#perform_content_negotiationself-request-forcefalse" title="Permanent link">¶</a></h4>
|
||||
<h3 id="dispatch-methods">Dispatch methods<a class="headerlink" href="#dispatch-methods" title="Permanent link">¶</a></h3>
|
||||
<p>The following methods are called directly by the view's <code>.dispatch()</code> method.
|
||||
These perform any actions that need to occur before or after calling the handler methods such as <code>.get()</code>, <code>.post()</code>, <code>put()</code>, <code>patch()</code> and <code>.delete()</code>.</p>
|
||||
<h3 id="initialself-request-args-kwargs">.initial(self, request, *args, **kwargs)<a class="headerlink" href="#initialself-request-args-kwargs" title="Permanent link">¶</a></h3>
|
||||
<h4 id="initialself-request-args-kwargs">.initial(self, request, *args, **kwargs)<a class="headerlink" href="#initialself-request-args-kwargs" title="Permanent link">¶</a></h4>
|
||||
<p>Performs any actions that need to occur before the handler method gets called.
|
||||
This method is used to enforce permissions and throttling, and perform content negotiation.</p>
|
||||
<p>You won't typically need to override this method.</p>
|
||||
<h3 id="handle_exceptionself-exc">.handle_exception(self, exc)<a class="headerlink" href="#handle_exceptionself-exc" title="Permanent link">¶</a></h3>
|
||||
<h4 id="handle_exceptionself-exc">.handle_exception(self, exc)<a class="headerlink" href="#handle_exceptionself-exc" title="Permanent link">¶</a></h4>
|
||||
<p>Any exception thrown by the handler method will be passed to this method, which either returns a <code>Response</code> instance, or re-raises the exception.</p>
|
||||
<p>The default implementation handles any subclass of <code>rest_framework.exceptions.APIException</code>, as well as Django's <code>Http404</code> and <code>PermissionDenied</code> exceptions, and returns an appropriate error response.</p>
|
||||
<p>If you need to customize the error responses your API returns you should subclass this method.</p>
|
||||
<h3 id="initialize_requestself-request-args-kwargs">.initialize_request(self, request, *args, **kwargs)<a class="headerlink" href="#initialize_requestself-request-args-kwargs" title="Permanent link">¶</a></h3>
|
||||
<h4 id="initialize_requestself-request-args-kwargs">.initialize_request(self, request, *args, **kwargs)<a class="headerlink" href="#initialize_requestself-request-args-kwargs" title="Permanent link">¶</a></h4>
|
||||
<p>Ensures that the request object that is passed to the handler method is an instance of <code>Request</code>, rather than the usual Django <code>HttpRequest</code>.</p>
|
||||
<p>You won't typically need to override this method.</p>
|
||||
<h3 id="finalize_responseself-request-response-args-kwargs">.finalize_response(self, request, response, *args, **kwargs)<a class="headerlink" href="#finalize_responseself-request-response-args-kwargs" title="Permanent link">¶</a></h3>
|
||||
<h4 id="finalize_responseself-request-response-args-kwargs">.finalize_response(self, request, response, *args, **kwargs)<a class="headerlink" href="#finalize_responseself-request-response-args-kwargs" title="Permanent link">¶</a></h4>
|
||||
<p>Ensures that any <code>Response</code> object returned from the handler method will be rendered into the correct content type, as determined by the content negotiation.</p>
|
||||
<p>You won't typically need to override this method.</p>
|
||||
<hr />
|
||||
<h1 id="function-based-views">Function Based Views<a class="headerlink" href="#function-based-views" title="Permanent link">¶</a></h1>
|
||||
<h2 id="function-based-views">Function Based Views<a class="headerlink" href="#function-based-views" title="Permanent link">¶</a></h2>
|
||||
<blockquote>
|
||||
<p>Saying [that class-based views] is always the superior solution is a mistake.</p>
|
||||
<p>— <a href="http://www.boredomandlaziness.org/2012/05/djangos-cbvs-are-not-mistake-but.html">Nick Coghlan</a></p>
|
||||
</blockquote>
|
||||
<p>REST framework also allows you to work with regular function based views. It provides a set of simple decorators that wrap your function based views to ensure they receive an instance of <code>Request</code> (rather than the usual Django <code>HttpRequest</code>) and allows them to return a <code>Response</code> (instead of a Django <code>HttpResponse</code>), and allow you to configure how the request is processed.</p>
|
||||
<h2 id="api_view">@api_view()<a class="headerlink" href="#api_view" title="Permanent link">¶</a></h2>
|
||||
<h3 id="api_view">@api_view()<a class="headerlink" href="#api_view" title="Permanent link">¶</a></h3>
|
||||
<p><strong>Signature:</strong> <code>@api_view(http_method_names=['GET'])</code></p>
|
||||
<p>The core of this functionality is the <code>api_view</code> decorator, which takes a list of HTTP methods that your view should respond to. For example, this is how you would write a very simple view that just manually returns some data:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>from rest_framework.decorators import api_view
|
||||
|
|
@ -3033,7 +3475,7 @@ def hello_world(request):
|
|||
return Response({"message": "Got some data!", "data": request.data})
|
||||
return Response({"message": "Hello, world!"})
|
||||
</code></pre></div>
|
||||
<h2 id="api-policy-decorators">API policy decorators<a class="headerlink" href="#api-policy-decorators" title="Permanent link">¶</a></h2>
|
||||
<h3 id="api-policy-decorators">API policy decorators<a class="headerlink" href="#api-policy-decorators" title="Permanent link">¶</a></h3>
|
||||
<p>To override the default settings, REST framework provides a set of additional decorators which can be added to your views. These must come <em>after</em> (below) the <code>@api_view</code> decorator. For example, to create a view that uses a <a href="../throttling/">throttle</a> to ensure it can only be called once per day by a particular user, use the <code>@throttle_classes</code> decorator, passing a list of throttle classes:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>from rest_framework.decorators import api_view, throttle_classes
|
||||
from rest_framework.throttling import UserRateThrottle
|
||||
|
|
@ -3060,7 +3502,7 @@ def view(request):
|
|||
</ul>
|
||||
<p>Each of these decorators is equivalent to setting their respective <a href="./#api-policy-attributes">api policy attributes</a>.</p>
|
||||
<p>All decorators take a single argument. The ones that end with <code>_class</code> expect a single class while the ones ending in <code>_classes</code> expect a list or tuple of classes.</p>
|
||||
<h2 id="view-schema-decorator">View schema decorator<a class="headerlink" href="#view-schema-decorator" title="Permanent link">¶</a></h2>
|
||||
<h3 id="view-schema-decorator">View schema decorator<a class="headerlink" href="#view-schema-decorator" title="Permanent link">¶</a></h3>
|
||||
<p>To override the default schema generation for function based views you may use
|
||||
the <code>@schema</code> decorator. This must come <em>after</em> (below) the <code>@api_view</code>
|
||||
decorator. For example:</p>
|
||||
|
|
@ -3146,7 +3588,7 @@ def view(request):
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -968,6 +966,129 @@
|
|||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-reference" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Reference
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Reference">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#viewset" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ViewSet
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#genericviewset" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
GenericViewSet
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#modelviewset" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ModelViewSet
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="ModelViewSet">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example_1" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#readonlymodelviewset" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ReadOnlyModelViewSet
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="ReadOnlyModelViewSet">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example_2" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-viewset-base-classes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom ViewSet base classes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom ViewSet base classes">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example_3" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -2651,6 +2772,227 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#viewset-actions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ViewSet actions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#introspecting-viewset-actions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Introspecting ViewSet actions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#marking-extra-actions-for-routing" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Marking extra actions for routing
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Marking extra actions for routing">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#routing-additional-http-methods-for-extra-actions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Routing additional HTTP methods for extra actions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#reversing-action-urls" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Reversing action URLs
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-reference" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Reference
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API Reference">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#viewset" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ViewSet
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#genericviewset" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
GenericViewSet
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#modelviewset" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ModelViewSet
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="ModelViewSet">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example_1" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#readonlymodelviewset" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ReadOnlyModelViewSet
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="ReadOnlyModelViewSet">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example_2" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#custom-viewset-base-classes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Custom ViewSet base classes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Custom ViewSet base classes">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example_3" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2917,14 +3259,14 @@ class UserViewSet(viewsets.ModelViewSet):
|
|||
</code></pre></div>
|
||||
<p>The <code>url_name</code> argument for <code>.reverse_action()</code> should match the same argument to the <code>@action</code> decorator. Additionally, this method can be used to reverse the default actions, such as <code>list</code> and <code>create</code>.</p>
|
||||
<hr />
|
||||
<h1 id="api-reference">API Reference<a class="headerlink" href="#api-reference" title="Permanent link">¶</a></h1>
|
||||
<h2 id="viewset">ViewSet<a class="headerlink" href="#viewset" title="Permanent link">¶</a></h2>
|
||||
<h2 id="api-reference">API Reference<a class="headerlink" href="#api-reference" title="Permanent link">¶</a></h2>
|
||||
<h3 id="viewset">ViewSet<a class="headerlink" href="#viewset" title="Permanent link">¶</a></h3>
|
||||
<p>The <code>ViewSet</code> class inherits from <code>APIView</code>. You can use any of the standard attributes such as <code>permission_classes</code>, <code>authentication_classes</code> in order to control the API policy on the viewset.</p>
|
||||
<p>The <code>ViewSet</code> class does not provide any implementations of actions. In order to use a <code>ViewSet</code> class you'll override the class and define the action implementations explicitly.</p>
|
||||
<h2 id="genericviewset">GenericViewSet<a class="headerlink" href="#genericviewset" title="Permanent link">¶</a></h2>
|
||||
<h3 id="genericviewset">GenericViewSet<a class="headerlink" href="#genericviewset" title="Permanent link">¶</a></h3>
|
||||
<p>The <code>GenericViewSet</code> class inherits from <code>GenericAPIView</code>, and provides the default set of <code>get_object</code>, <code>get_queryset</code> methods and other generic view base behavior, but does not include any actions by default.</p>
|
||||
<p>In order to use a <code>GenericViewSet</code> class you'll override the class and either mixin the required mixin classes, or define the action implementations explicitly.</p>
|
||||
<h2 id="modelviewset">ModelViewSet<a class="headerlink" href="#modelviewset" title="Permanent link">¶</a></h2>
|
||||
<h3 id="modelviewset">ModelViewSet<a class="headerlink" href="#modelviewset" title="Permanent link">¶</a></h3>
|
||||
<p>The <code>ModelViewSet</code> class inherits from <code>GenericAPIView</code> and includes implementations for various actions, by mixing in the behavior of the various mixin classes.</p>
|
||||
<p>The actions provided by the <code>ModelViewSet</code> class are <code>.list()</code>, <code>.retrieve()</code>, <code>.create()</code>, <code>.update()</code>, <code>.partial_update()</code>, and <code>.destroy()</code>.</p>
|
||||
<h4 id="example_1">Example<a class="headerlink" href="#example_1" title="Permanent link">¶</a></h4>
|
||||
|
|
@ -2951,7 +3293,7 @@ class UserViewSet(viewsets.ModelViewSet):
|
|||
</code></pre></div>
|
||||
<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">ReadOnlyModelViewSet<a class="headerlink" href="#readonlymodelviewset" title="Permanent link">¶</a></h2>
|
||||
<h3 id="readonlymodelviewset">ReadOnlyModelViewSet<a class="headerlink" href="#readonlymodelviewset" title="Permanent link">¶</a></h3>
|
||||
<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>
|
||||
<h4 id="example_2">Example<a class="headerlink" href="#example_2" title="Permanent link">¶</a></h4>
|
||||
<p>As with <code>ModelViewSet</code>, you'll normally need to provide at least the <code>queryset</code> and <code>serializer_class</code> attributes. For example:</p>
|
||||
|
|
@ -2963,9 +3305,9 @@ class UserViewSet(viewsets.ModelViewSet):
|
|||
serializer_class = AccountSerializer
|
||||
</code></pre></div>
|
||||
<p>Again, as with <code>ModelViewSet</code>, you can use any of the standard attributes and method overrides available to <code>GenericAPIView</code>.</p>
|
||||
<h1 id="custom-viewset-base-classes">Custom ViewSet base classes<a class="headerlink" href="#custom-viewset-base-classes" title="Permanent link">¶</a></h1>
|
||||
<h2 id="custom-viewset-base-classes">Custom ViewSet base classes<a class="headerlink" href="#custom-viewset-base-classes" title="Permanent link">¶</a></h2>
|
||||
<p>You may need to provide custom <code>ViewSet</code> classes that do not have the full set of <code>ModelViewSet</code> actions, or that customize the behavior in some other way.</p>
|
||||
<h2 id="example_3">Example<a class="headerlink" href="#example_3" title="Permanent link">¶</a></h2>
|
||||
<h3 id="example_3">Example<a class="headerlink" href="#example_3" title="Permanent link">¶</a></h3>
|
||||
<p>To create a base viewset class that provides <code>create</code>, <code>list</code> and <code>retrieve</code> operations, inherit from <code>GenericViewSet</code>, and mixin the required actions:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>from rest_framework import mixins, viewsets
|
||||
|
||||
|
|
@ -3044,7 +3386,7 @@ class CreateListRetrieveViewSet(mixins.CreateModelMixin,
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -3232,6 +3230,685 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#new-features" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
New features
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="New features">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#rest-framework-under-the-hood" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
REST framework: Under the hood.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#request-objects" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Request objects
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Request objects">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-data-and-query_params-properties" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The .data and .query_params properties.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#serializers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Serializers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Serializers">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#single-step-object-creation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Single-step object creation.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-create-and-update-methods" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The .create() and .update() methods.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#use-validated_data-instead-of-object" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Use .validated_data instead of .object.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-is_validraise_exceptiontrue" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using .is_valid(raise_exception=True)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-serializersvalidationerror" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using serializers.ValidationError.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#change-to-validate_field_name" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Change to validate_<field_name>.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#removal-of-transform_field_name" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Removal of transform_<field_name>.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#differences-between-modelserializer-validation-and-modelform" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Differences between ModelSerializer validation and ModelForm.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#writable-nested-serialization" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Writable nested serialization.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#printable-serializer-representations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Printable serializer representations.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-extra_kwargs-option" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The extra_kwargs option.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#changes-to-hyperlinkedmodelserializer" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Changes to HyperlinkedModelSerializer.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#fields-for-model-methods-and-properties" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Fields for model methods and properties.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-listserializer-class" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The ListSerializer class.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-baseserializer-class" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The BaseSerializer class.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="The BaseSerializer class.">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#read-only-baseserializer-classes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Read-only BaseSerializer classes.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#read-write-baseserializer-classes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Read-write BaseSerializer classes.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#creating-new-generic-serializers-with-baseserializer" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Creating new generic serializers with BaseSerializer.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#serializer-fields" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Serializer fields
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Serializer fields">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-field-and-readonly-field-classes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The Field and ReadOnly field classes.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-required-allow_null-allow_blank-and-default-arguments" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The required, allow_null, allow_blank and default arguments.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#coercing-output-types" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Coercing output types.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#removal-of-validate" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Removal of .validate().
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-listfield-class" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The ListField class.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-choicefield-class-may-now-accept-a-flat-list" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The ChoiceField class may now accept a flat list.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-multiplechoicefield-class" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The MultipleChoiceField class.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#changes-to-the-custom-field-api" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Changes to the custom field API.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#explicit-queryset-required-on-relational-fields" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Explicit queryset required on relational fields.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#optional-argument-to-serializermethodfield" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Optional argument to SerializerMethodField.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#enforcing-consistent-source-usage" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Enforcing consistent source usage.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-uniquevalidator-and-uniquetogethervalidator-classes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The UniqueValidator and UniqueTogetherValidator classes.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-uniquefordatevalidator-classes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The UniqueForDateValidator classes.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#generic-views" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Generic views
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Generic views">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#simplification-of-view-logic" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Simplification of view logic.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#changes-to-prepost-save-hooks" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Changes to pre/post save hooks.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#removal-of-view-attributes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Removal of view attributes.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#put-as-create" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
PUT as create.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#customizing-error-responses" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Customizing error responses.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-metadata-api" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The metadata API
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#serializers-as-html-forms" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Serializers as HTML forms
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Serializers as HTML forms">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-style-keyword-argument-for-serializer-fields" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The style keyword argument for serializer fields.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-style" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API style
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="API style">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#unicode-json-by-default" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Unicode JSON by default.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#compact-json-by-default" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Compact JSON by default.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#file-fields-as-urls" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
File fields as URLs
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#throttle-headers-using-retry-after" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Throttle headers using Retry-After.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#date-and-time-objects-as-iso-8601-strings-in-serializer-data" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Date and time objects as ISO-8601 strings in serializer data.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#decimals-as-strings-in-serializer-data" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Decimals as strings in serializer data.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#miscellaneous-notes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Miscellaneous notes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#whats-coming-next" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
What's coming next
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -4092,7 +4769,7 @@ amount = serializers.DecimalField(
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2706,6 +2704,159 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#pagination" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Pagination
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Pagination">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#new-pagination-schemes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
New pagination schemes.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#pagination-controls-in-the-browsable-api" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Pagination controls in the browsable API.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#support-for-header-based-pagination" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Support for header-based pagination.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#versioning" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Versioning
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#internationalization" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Internationalization
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#new-field-types" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
New field types
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#modelserializer-api" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ModelSerializer API
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#moving-packages-out-of-core" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Moving packages out of core
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#deprecations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Deprecations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#whats-next" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
What's next?
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2968,7 +3119,7 @@ Host: example.org
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2662,6 +2660,115 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#openapi-schema-generation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
OpenAPI Schema Generation
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#continuing-to-use-coreapi" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Continuing to use CoreAPI
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#openapi-quickstart" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
OpenAPI Quickstart
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="OpenAPI Quickstart">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#customization" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Customization
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#api-documentation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
API Documentation
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#feature-roadmap" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Feature Roadmap
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#funding" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Funding
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2892,7 +2999,7 @@ continued development by <strong><a href="https://opencollective.com/django-rest
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2612,6 +2610,65 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#openapi-schema-generation-improvements" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
OpenAPI Schema Generation Improvements
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#validator-default-context" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Validator / Default Context
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#funding" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Funding
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2823,7 +2880,7 @@ continued development by <strong><a href="https://opencollective.com/django-rest
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2712,6 +2710,165 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#grouping-operations-with-tags" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Grouping operations with tags.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#customizing-the-operation-id" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Customizing the operation ID.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#support-for-openapi-components" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Support for OpenAPI components.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#more-public-api" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
More Public API
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#support-for-jsonfield" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Support for JSONField.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#searchfilter-improvements" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
SearchFilter improvements
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="SearchFilter improvements">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#nested-searches-against-jsonfield-and-hstorefield" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Nested searches against JSONField and HStoreField
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#searches-against-annotate-fields" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Searches against annotate fields
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#deprecations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Deprecations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Deprecations">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#serializersnullbooleanfield" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
serializers.NullBooleanField
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#funding" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Funding
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2992,7 +3149,7 @@ continued development by <strong><a href="https://opencollective.com/django-rest
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2601,6 +2599,54 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-40-support" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django 4.0 support
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#fields-arguments-are-now-keyword-only" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Fields arguments are now keyword-only
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2763,7 +2809,7 @@ are likely in the composite fields, <code>ListField</code> and <code>DictField</
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2673,6 +2671,126 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-41-support" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django 4.1 support
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#raise_exception-argument-for-is_valid-is-now-keyword-only" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
raise_exception argument for is_valid is now keyword-only.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#manyrelatedfield-supports-returning-the-default-when-the-source-attribute-doesnt-exist" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ManyRelatedField supports returning the default when the source attribute doesn't exist.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#make-open-api-get_reference-public" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Make Open API get_reference public.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#change-semantic-of-or-of-two-permission-classes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Change semantic of OR of two permission classes.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#minor-fixes-and-improvements" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Minor fixes and improvements
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#deprecations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Deprecations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Deprecations">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#serializersnullbooleanfield" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
serializers.NullBooleanField
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2843,7 +2961,7 @@ skipped depending on the other arguments.</p>
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2645,6 +2643,98 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-50-and-python-312-support" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django 5.0 and Python 3.12 support
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#primary-support-of-uniqueconstraint" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Primary Support of UniqueConstraint
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#simplerouter-non-regex-matching-support" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
SimpleRouter non-regex matching support
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#zoneinfo-as-the-primary-source-of-timezone-data" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ZoneInfo as the primary source of timezone data
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#align-searchfilter-behavior-to-djangocontribadmin-search" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Align SearchFilter behavior to django.contrib.admin search
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#other-fixes-and-improvements" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Other fixes and improvements
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2800,7 +2890,7 @@
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2623,6 +2621,76 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#updated-django-and-python-support" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Updated Django and Python support
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-loginrequiredmiddleware" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django LoginRequiredMiddleware
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#improved-support-for-uniqueconstraint" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Improved support for UniqueConstraint
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#other-fixes-and-improvements" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Other fixes and improvements
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2774,7 +2842,7 @@
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2662,6 +2660,115 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#adminrenderer" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
AdminRenderer
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#supported-versions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Supported versions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#deprecations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Deprecations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#modifications-to-list-behaviors" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Modifications to list behaviors
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Modifications to list behaviors">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#manytomany-fields-and-blanktrue" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ManyToMany fields and blank=True
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#list-fields-and-allow_null" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
List fields and allow_null
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#whats-next" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
What's next?
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2865,7 +2972,7 @@
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2612,6 +2610,65 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#release-notes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Release notes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#supported-versions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Supported versions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#deprecations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Deprecations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2771,7 +2828,7 @@
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2673,6 +2671,126 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#funding" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Funding
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#schemas-client-libraries" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Schemas & client libraries
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#supported-versions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Supported versions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#deprecations-and-changes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Deprecations and changes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Deprecations and changes">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#use-fields-or-exclude-on-serializer-classes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Use fields or exclude on serializer classes.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#microsecond-precision-when-returning-time-or-datetime" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Microsecond precision when returning time or datetime.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#relational-choices-no-longer-displayed-in-options-requests" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Relational choices no longer displayed in OPTIONS requests.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#other-improvements" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Other improvements
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2947,7 +3065,7 @@ metadata class</a>.</p>
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2750,6 +2748,203 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#funding" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Funding
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#improved-schema-generation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Improved schema generation
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#requests-test-client" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Requests test client
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#core-api-client" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Core API client
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#live-tests" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Live tests
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#raml-support" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
RAML support
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#validation-codes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Validation codes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#client-upload-download-support" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Client upload & download support
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#deprecations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Deprecations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Deprecations">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#generating-schemas-from-router" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Generating schemas from Router
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#schema-path-representations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Schema path representations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#schema-action-name-representations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Schema action name representations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#djangofilterbackend" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DjangoFilterBackend
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#corejson-media-type" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
CoreJSON media type
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#modelserializer-fields-and-exclude" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ModelSerializer 'fields' and 'exclude'
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -3065,7 +3260,7 @@ in version 3.3 and raised a deprecation warning in 3.4. Its usage is now mandato
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2684,6 +2682,137 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#funding" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Funding
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#interactive-api-documentation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Interactive API documentation
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#javascript-client-library" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
JavaScript client library
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#authentication-classes-for-the-python-client-library" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Authentication classes for the Python client library
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#deprecations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Deprecations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Deprecations">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#updating-coreapi" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Updating coreapi
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#generating-schemas-from-router" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Generating schemas from Router
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#djangofilterbackend" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DjangoFilterBackend
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#whats-next" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
What's next
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2958,7 +3087,7 @@ on realtime support, for the 3.7 release.</p>
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2673,6 +2671,126 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#funding" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Funding
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#customizing-api-docs-schema-generation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Customizing API docs & schema generation.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#django-20-support" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Django 2.0 support
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#minor-fixes-and-improvements" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Minor fixes and improvements
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#deprecations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Deprecations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Deprecations">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#exclude_from_schema" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
exclude_from_schema
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#djangofilterbackend" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DjangoFilterBackend
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#whats-next" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
What's next
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2881,7 +2999,7 @@ class CustomView(APIView):
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2679,6 +2677,132 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#funding" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Funding
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#breaking-changes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Breaking Changes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Breaking Changes">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#altered-the-behavior-of-read_only-plus-default-on-field" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Altered the behavior of read_only plus default on Field.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#deprecations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Deprecations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Deprecations">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#action-decorator-replaces-list_route-and-detail_route" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
action decorator replaces list_route and detail_route
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#exclude_from_schema" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
exclude_from_schema
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#minor-fixes-and-improvements" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Minor fixes and improvements
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#whats-next" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
What's next
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2861,7 +2985,7 @@ for a complete listing.</p>
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2717,6 +2715,170 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#funding" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Funding
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#built-in-openapi-schema-support" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Built-in OpenAPI schema support
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#composable-permission-classes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Composable permission classes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#viewset-extra-actions-available-in-the-browsable-api" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
ViewSet Extra Actions available in the Browsable API
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#supported-versions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Supported Versions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#deprecations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Deprecations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Deprecations">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#djangoobjectpermissionsfilter-moved-to-third-party-package" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
DjangoObjectPermissionsFilter moved to third-party package.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#router-argumentmethod-renamed-to-use-basename-for-consistency" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Router argument/method renamed to use basename for consistency.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#action-decorator-replaces-list_route-and-detail_route" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
action decorator replaces list_route and detail_route
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#exclude_from_schema" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
exclude_from_schema
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#minor-fixes-and-improvements" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Minor fixes and improvements
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#whats-next" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
What's next
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2978,7 +3140,7 @@ ASGI.</p>
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -1960,6 +1958,201 @@
|
|||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#issues" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Issues
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Issues">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#triaging-issues" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Triaging issues
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#development" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Development
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Development">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#testing" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Testing
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Testing">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#test-options" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Test options
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#running-against-multiple-environments" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Running against multiple environments
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#pull-requests" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Pull requests
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#managing-compatibility-issues" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Managing compatibility issues
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#documentation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Documentation
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Documentation">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#building-the-documentation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Building the documentation
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#language-style" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Language style
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#markdown-style" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Markdown style
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Markdown style">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#1-headers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
1. Headers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#2-links" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
2. Links
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#3-notes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
3. Notes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -2601,6 +2794,249 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#community" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Community
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#code-of-conduct" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Code of conduct
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#issues" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Issues
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Issues">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#triaging-issues" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Triaging issues
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#development" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Development
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Development">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#testing" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Testing
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Testing">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#test-options" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Test options
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#running-against-multiple-environments" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Running against multiple environments
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#pull-requests" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Pull requests
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#managing-compatibility-issues" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Managing compatibility issues
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#documentation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Documentation
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Documentation">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#building-the-documentation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Building the documentation
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#language-style" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Language style
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#markdown-style" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Markdown style
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Markdown style">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#1-headers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
1. Headers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#2-links" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
2. Links
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#3-notes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
3. Notes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2681,14 +3117,14 @@
|
|||
<p>Please keep the tone polite & professional. For some users a discussion on the REST framework mailing list or ticket tracker may be their first engagement with the open source community. First impressions count, so let's try to make everyone feel welcome.</p>
|
||||
<p>Be mindful in the language you choose. As an example, in an environment that is heavily male-dominated, posts that start 'Hey guys,' can come across as unintentionally exclusive. It's just as easy, and more inclusive to use gender neutral language in those situations.</p>
|
||||
<p>The <a href="https://www.djangoproject.com/conduct/">Django code of conduct</a> gives a fuller set of guidelines for participating in community forums.</p>
|
||||
<h1 id="issues">Issues<a class="headerlink" href="#issues" title="Permanent link">¶</a></h1>
|
||||
<h2 id="issues">Issues<a class="headerlink" href="#issues" title="Permanent link">¶</a></h2>
|
||||
<p>Our contribution process is that the <a href="https://github.com/encode/django-rest-framework/discussions">GitHub discussions page</a> should generally be your starting point. Some tips on good potential issue reporting:</p>
|
||||
<ul>
|
||||
<li>Django REST framework is considered feature-complete. Please do not file requests to change behavior, unless it is required for security reasons or to maintain compatibility with upcoming Django or Python versions.</li>
|
||||
<li>Search the GitHub project page for related items, and make sure you're running the latest version of REST framework before reporting an issue.</li>
|
||||
<li>Feature requests will typically be closed with a recommendation that they be implemented outside the core REST framework library (e.g. as third-party libraries). This approach allows us to keep down the maintenance overhead of REST framework, so that the focus can be on continued stability and great documentation.</li>
|
||||
</ul>
|
||||
<h2 id="triaging-issues">Triaging issues<a class="headerlink" href="#triaging-issues" title="Permanent link">¶</a></h2>
|
||||
<h3 id="triaging-issues">Triaging issues<a class="headerlink" href="#triaging-issues" title="Permanent link">¶</a></h3>
|
||||
<p>Getting involved in triaging incoming issues is a good way to start contributing. Every single ticket that comes into the ticket tracker needs to be reviewed in order to determine what the next steps should be. Anyone can help out with this, you just need to be willing to</p>
|
||||
<ul>
|
||||
<li>Read through the ticket - does it make sense, is it missing any context that would help explain it better?</li>
|
||||
|
|
@ -2697,7 +3133,7 @@
|
|||
<li>If the ticket is a feature request, could the feature request instead be implemented as a third party package?</li>
|
||||
<li>If a ticket hasn't had much activity and addresses something you need, then comment on the ticket and try to find out what's needed to get it moving again.</li>
|
||||
</ul>
|
||||
<h1 id="development">Development<a class="headerlink" href="#development" title="Permanent link">¶</a></h1>
|
||||
<h2 id="development">Development<a class="headerlink" href="#development" title="Permanent link">¶</a></h2>
|
||||
<p>To start developing on Django REST framework, first create a Fork from the
|
||||
<a href="https://github.com/encode/django-rest-framework">Django REST Framework repo</a> on GitHub.</p>
|
||||
<p>Then clone your fork. The clone command will look like this, with your GitHub
|
||||
|
|
@ -2713,7 +3149,7 @@ To set them up, first ensure you have the pre-commit tool installed, for example
|
|||
<p>Then run:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>pre-commit install
|
||||
</code></pre></div>
|
||||
<h2 id="testing">Testing<a class="headerlink" href="#testing" title="Permanent link">¶</a></h2>
|
||||
<h3 id="testing">Testing<a class="headerlink" href="#testing" title="Permanent link">¶</a></h3>
|
||||
<p>To run the tests, clone the repository, and then:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code># Setup the virtual environment
|
||||
python3 -m venv env
|
||||
|
|
@ -2745,7 +3181,7 @@ class MyDatabaseTest:
|
|||
</code></pre></div>
|
||||
<p>You can reuse existing models defined in <code>tests/models.py</code> for your tests.</p>
|
||||
</div>
|
||||
<h3 id="test-options">Test options<a class="headerlink" href="#test-options" title="Permanent link">¶</a></h3>
|
||||
<h4 id="test-options">Test options<a class="headerlink" href="#test-options" title="Permanent link">¶</a></h4>
|
||||
<p>Run using a more concise output style.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>./runtests.py -q
|
||||
</code></pre></div>
|
||||
|
|
@ -2765,11 +3201,11 @@ class MyDatabaseTest:
|
|||
<p class="admonition-title">Note</p>
|
||||
<p>The test case and test method matching is fuzzy and will sometimes run other tests that contain a partial string match to the given command line input.</p>
|
||||
</div>
|
||||
<h3 id="running-against-multiple-environments">Running against multiple environments<a class="headerlink" href="#running-against-multiple-environments" title="Permanent link">¶</a></h3>
|
||||
<h4 id="running-against-multiple-environments">Running against multiple environments<a class="headerlink" href="#running-against-multiple-environments" title="Permanent link">¶</a></h4>
|
||||
<p>You can also use the excellent <a href="https://tox.readthedocs.io/en/latest/">tox</a> testing tool to run the tests against all supported versions of Python and Django. Install <code>tox</code> globally, and then simply run:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>tox
|
||||
</code></pre></div>
|
||||
<h2 id="pull-requests">Pull requests<a class="headerlink" href="#pull-requests" title="Permanent link">¶</a></h2>
|
||||
<h3 id="pull-requests">Pull requests<a class="headerlink" href="#pull-requests" title="Permanent link">¶</a></h3>
|
||||
<p>It's a good idea to make pull requests early on. A pull request represents the start of a discussion, and doesn't necessarily need to be the final, finished submission.</p>
|
||||
<p>It's also always best to make a new branch before starting work on a pull request. This means that you'll be able to later switch back to working on another separate issue without interfering with an ongoing pull requests.</p>
|
||||
<p>It's also useful to remember that if you have an outstanding pull request then pushing new commits to your GitHub repo will also automatically update the pull requests.</p>
|
||||
|
|
@ -2778,12 +3214,12 @@ class MyDatabaseTest:
|
|||
<p>Once you've made a pull request take a look at the build status in the GitHub interface and make sure the tests are running as you'd expect.</p>
|
||||
<p><img alt="Build status" src="../../img/build-status.png" /></p>
|
||||
<p><em>Above: build notifications</em></p>
|
||||
<h2 id="managing-compatibility-issues">Managing compatibility issues<a class="headerlink" href="#managing-compatibility-issues" title="Permanent link">¶</a></h2>
|
||||
<h3 id="managing-compatibility-issues">Managing compatibility issues<a class="headerlink" href="#managing-compatibility-issues" title="Permanent link">¶</a></h3>
|
||||
<p>Sometimes, in order to ensure your code works on various different versions of Django, Python or third party libraries, you'll need to run slightly different code depending on the environment. Any code that branches in this way should be isolated into the <code>compat.py</code> module, and should provide a single common interface that the rest of the codebase can use.</p>
|
||||
<h1 id="documentation">Documentation<a class="headerlink" href="#documentation" title="Permanent link">¶</a></h1>
|
||||
<h2 id="documentation">Documentation<a class="headerlink" href="#documentation" title="Permanent link">¶</a></h2>
|
||||
<p>The documentation for REST framework is built from the <a href="https://daringfireball.net/projects/markdown/basics">Markdown</a> source files in <a href="https://github.com/encode/django-rest-framework/tree/main/docs">the docs directory</a>.</p>
|
||||
<p>There are many great Markdown editors that make working with the documentation really easy. The <a href="http://mouapp.com/">Mou editor for Mac</a> is one such editor that comes highly recommended.</p>
|
||||
<h2 id="building-the-documentation">Building the documentation<a class="headerlink" href="#building-the-documentation" title="Permanent link">¶</a></h2>
|
||||
<h3 id="building-the-documentation">Building the documentation<a class="headerlink" href="#building-the-documentation" title="Permanent link">¶</a></h3>
|
||||
<p>To build the documentation, install MkDocs with <code>pip install mkdocs</code> and then run the following command.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>mkdocs build
|
||||
</code></pre></div>
|
||||
|
|
@ -2791,16 +3227,16 @@ class MyDatabaseTest:
|
|||
<p>You can build the documentation and open a preview in a browser window by using the <code>serve</code> command.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>mkdocs serve
|
||||
</code></pre></div>
|
||||
<h2 id="language-style">Language style<a class="headerlink" href="#language-style" title="Permanent link">¶</a></h2>
|
||||
<h3 id="language-style">Language style<a class="headerlink" href="#language-style" title="Permanent link">¶</a></h3>
|
||||
<p>Documentation should be in American English. The tone of the documentation is very important - try to stick to a simple, plain, objective and well-balanced style where possible.</p>
|
||||
<p>Some other tips:</p>
|
||||
<ul>
|
||||
<li>Keep paragraphs reasonably short.</li>
|
||||
<li>Don't use abbreviations such as 'e.g.' but instead use the long form, such as 'For example'.</li>
|
||||
</ul>
|
||||
<h2 id="markdown-style">Markdown style<a class="headerlink" href="#markdown-style" title="Permanent link">¶</a></h2>
|
||||
<h3 id="markdown-style">Markdown style<a class="headerlink" href="#markdown-style" title="Permanent link">¶</a></h3>
|
||||
<p>There are a couple of conventions you should follow when working on the documentation.</p>
|
||||
<h5 id="1-headers">1. Headers<a class="headerlink" href="#1-headers" title="Permanent link">¶</a></h5>
|
||||
<h4 id="1-headers">1. Headers<a class="headerlink" href="#1-headers" title="Permanent link">¶</a></h4>
|
||||
<p>Headers should use the hash style. For example:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>### Some important topic
|
||||
</code></pre></div>
|
||||
|
|
@ -2808,7 +3244,7 @@ class MyDatabaseTest:
|
|||
<div class="language-text highlight"><pre><span></span><code>Some important topic
|
||||
====================
|
||||
</code></pre></div>
|
||||
<h5 id="2-links">2. Links<a class="headerlink" href="#2-links" title="Permanent link">¶</a></h5>
|
||||
<h4 id="2-links">2. Links<a class="headerlink" href="#2-links" title="Permanent link">¶</a></h4>
|
||||
<p>Links should always use the reference style, with the referenced hyperlinks kept at the end of the document.</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>Here is a link to [some other thing][other-thing].
|
||||
|
||||
|
|
@ -2821,7 +3257,7 @@ More text...
|
|||
<div class="language-text highlight"><pre><span></span><code>[authentication]: ../api-guide/authentication.md
|
||||
</code></pre></div>
|
||||
<p>Linking in this style means you'll be able to click the hyperlink in your Markdown editor to open the referenced document. When the documentation is built, these links will be converted into regular links to HTML pages.</p>
|
||||
<h5 id="3-notes">3. Notes<a class="headerlink" href="#3-notes" title="Permanent link">¶</a></h5>
|
||||
<h4 id="3-notes">3. Notes<a class="headerlink" href="#3-notes" title="Permanent link">¶</a></h4>
|
||||
<p>If you want to draw attention to a note or warning, use an <a href="https://python-markdown.github.io/extensions/admonition/">admonition</a>, like so:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>!!! note
|
||||
A useful documentation note.
|
||||
|
|
@ -2886,7 +3322,7 @@ More text...
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -353,9 +353,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2588,6 +2586,43 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#places-to-look-for-django-rest-framework-jobs" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Places to look for Django REST Framework Jobs
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2728,7 +2763,7 @@
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2662,6 +2660,115 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#project-details" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Project details
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#sponsors" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Sponsors
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Sponsors">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#platinum-sponsors" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Platinum sponsors
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#gold-sponsors" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Gold sponsors
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#silver-sponsors" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Silver sponsors
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#advocates" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Advocates
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#supporters" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Supporters
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2915,7 +3022,7 @@
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2612,6 +2610,65 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#client-libraries" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Client libraries
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#realtime-apis" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Realtime APIs
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#accountability" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Accountability
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2790,7 +2847,7 @@ funded via the REST framework paid plans.</p>
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2657,6 +2655,110 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#maintenance-team" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Maintenance team
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Maintenance team">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#composition" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Composition
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#responsibilities" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Responsibilities
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#release-process" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Release process
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#project-ownership" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Project ownership
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Project ownership">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#outstanding-management-ownership-issues" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Outstanding management & ownership issues
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2856,7 +2958,7 @@ To modify this process for future releases make a pull request to the [project m
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2010,9 +2008,10 @@
|
|||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<nav class="md-nav" aria-label="Existing Third Party Packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#async-support" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
|
|
@ -2021,8 +2020,7 @@
|
|||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Async Support">
|
||||
<ul class="md-nav__list">
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#authentication" class="md-nav__link">
|
||||
|
|
@ -2817,6 +2815,270 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#about-third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
About Third Party Packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#creating-a-third-party-package" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Creating a Third Party Package
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Creating a Third Party Package">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#version-compatibility" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Version compatibility
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#once-your-package-is-available" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Once your package is available
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Once your package is available">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#adding-to-the-django-rest-framework-grid" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Adding to the Django REST framework grid
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#adding-to-the-django-rest-framework-docs" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Adding to the Django REST framework docs
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#announce-on-the-discussion-group" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Announce on the discussion group.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#existing-third-party-packages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Existing Third Party Packages
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Existing Third Party Packages">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#async-support" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Async Support
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#authentication" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Authentication
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#permissions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Permissions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#serializers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Serializers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#serializer-fields" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Serializer fields
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#views" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Views
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#routers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Routers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#parsers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Parsers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#renderers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Renderers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#filtering" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Filtering
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#misc" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Misc
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#customization" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Customization
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2904,7 +3166,7 @@
|
|||
<p>Django REST Framework has a growing community of developers, packages, and resources.</p>
|
||||
<p>Check out a grid detailing all the packages and ecosystem around Django REST Framework at <a href="https://www.djangopackages.com/grids/g/django-rest-framework/">Django Packages</a>.</p>
|
||||
<p>To submit new content, <a href="https://github.com/encode/django-rest-framework/compare">create a pull request</a>.</p>
|
||||
<h2 id="async-support">Async Support<a class="headerlink" href="#async-support" title="Permanent link">¶</a></h2>
|
||||
<h3 id="async-support">Async Support<a class="headerlink" href="#async-support" title="Permanent link">¶</a></h3>
|
||||
<ul>
|
||||
<li><a href="https://github.com/em1208/adrf">adrf</a> - Async support, provides async Views, ViewSets, and Serializers.</li>
|
||||
</ul>
|
||||
|
|
@ -3087,7 +3349,7 @@
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -1965,10 +1963,9 @@
|
|||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Articles">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#documentations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
|
|
@ -1977,11 +1974,6 @@
|
|||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -2679,6 +2671,126 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#books" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Books
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#courses" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Courses
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#tutorials" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Tutorials
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#videos" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Videos
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Videos">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#talks" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Talks
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#tutorials_1" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Tutorials
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#articles" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Articles
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#documentations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Documentations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2813,12 +2925,12 @@
|
|||
<li><a href="https://web.archive.org/web/20180104205054/http://machinalis.com/blog/oauth2-authentication/">OAuth2 Authentication with Django REST Framework and Custom Third-Party OAuth2 Backends</a></li>
|
||||
<li><a href="https://web.archive.org/web/20180104205109/http://machinalis.com/blog/nested-resources-with-django/">Nested Resources with Django REST Framework</a></li>
|
||||
<li><a href="https://web.archive.org/web/20180104205048/http://machinalis.com/blog/image-fields-with-django-rest-framework/">Image Fields with Django REST Framework</a></li>
|
||||
<li><a href="https://chatbotslife.com/chatbot-using-django-rest-framework-api-ai-slack-part-1-3-69c7e38b7b1e#.g2aceuncf">Chatbot Using Django REST Framework + api.ai + Slack — Part 1/3</a></li>
|
||||
<li><a href="https://chatbotslife.com/chatbot-using-django-rest-framework-api-ai-slack-part-1-3-69c7e38b7b1e#.g2aceuncf">Chatbot Using Django REST Framework + api.ai + Slack - Part 1/3</a></li>
|
||||
<li><a href="https://blog.levit.be/new-django-admin-with-emberjs-what-are-the-news/">New Django Admin with DRF and EmberJS... What are the News?</a></li>
|
||||
<li><a href="https://medium.com/django-rest-framework">Blog posts about Django REST Framework</a></li>
|
||||
<li><a href="https://doordash.engineering/2013/10/07/implementing-rest-apis-with-embedded-privacy/">Implementing Rest APIs With Embedded Privacy</a></li>
|
||||
</ul>
|
||||
<h3 id="documentations">Documentations<a class="headerlink" href="#documentations" title="Permanent link">¶</a></h3>
|
||||
<h2 id="documentations">Documentations<a class="headerlink" href="#documentations" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
<li><a href="http://www.cdrf.co">Classy Django REST Framework</a></li>
|
||||
<li><a href="https://drf-schema-adapter.readthedocs.io/en/latest/">DRF-schema-adapter</a></li>
|
||||
|
|
@ -2883,7 +2995,7 @@
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
133
index.html
133
index.html
|
|
@ -344,7 +344,9 @@
|
|||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" hidden>
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
|
@ -353,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2656,12 +2656,128 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#requirements" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Requirements
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#installation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Installation
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#example" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Example
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#quickstart" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Quickstart
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#development" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Development
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#support" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Support
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#security" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Security
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#license" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
License
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -2671,6 +2787,8 @@
|
|||
<article class="md-content__inner md-typeset">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -2863,10 +2981,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</article>
|
||||
|
|
@ -2915,7 +3038,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": ".", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": ".", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
140
sitemap.xml
140
sitemap.xml
|
|
@ -2,282 +2,282 @@
|
|||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/authentication/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/caching/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/content-negotiation/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/exceptions/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/fields/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/filtering/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/format-suffixes/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/generic-views/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/metadata/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/pagination/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/parsers/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/permissions/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/relations/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/renderers/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/requests/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/responses/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/reverse/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/routers/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/schemas/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/serializers/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/settings/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/status-codes/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/testing/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/throttling/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/validators/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/versioning/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/views/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/viewsets/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.0-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.1-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.10-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.11-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.12-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.13-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.14-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.15-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.16-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.2-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.3-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.4-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.5-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.6-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.7-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.8-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.9-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/contributing/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/jobs/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/kickstarter-announcement/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/mozilla-grant/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/project-management/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/release-notes/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/third-party-packages/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/tutorials-and-resources/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/theme/src/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/topics/ajax-csrf-cors/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/topics/browsable-api/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/topics/browser-enhancements/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/topics/documenting-your-api/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/topics/html-and-forms/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/topics/internationalization/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/topics/rest-hypermedia-hateoas/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/topics/writable-nested-serializers/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/1-serialization/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/2-requests-and-responses/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/3-class-based-views/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/4-authentication-and-permissions/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/5-relationships-and-hyperlinked-apis/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/quickstart/</loc>
|
||||
<lastmod>2026-03-01</lastmod>
|
||||
<lastmod>2026-03-03</lastmod>
|
||||
</url>
|
||||
</urlset>
|
||||
BIN
sitemap.xml.gz
BIN
sitemap.xml.gz
Binary file not shown.
|
|
@ -349,9 +349,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2521,6 +2519,24 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2603,7 +2619,7 @@
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2612,6 +2610,65 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#javascript-clients" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Javascript clients
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#csrf-protection" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
CSRF protection
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#cors" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
CORS
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2754,7 +2811,7 @@
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2762,6 +2760,215 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#urls" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
URLs
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#formats" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Formats
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#authentication" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Authentication
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#customizing" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Customizing
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Customizing">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#overriding-the-default-theme" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Overriding the default theme
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages-for-customization" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third party packages for customization
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#blocks" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Blocks
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Blocks">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#components" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Components
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#tooltips" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Tooltips
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#login-template" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Login Template
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#advanced-customization" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Advanced Customization
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Advanced Customization">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#context" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Context
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#not-using-basehtml" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Not using base.html
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#handling-choicefield-with-large-numbers-of-items" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Handling ChoiceField with large numbers of items.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#autocomplete" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Autocomplete
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -3022,7 +3229,7 @@
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2645,6 +2643,98 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#browser-based-put-delete-etc" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Browser based PUT, DELETE, etc...
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#browser-based-submission-of-non-form-content" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Browser based submission of non-form content
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#url-based-format-suffixes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
URL based format suffixes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#http-header-based-method-overriding" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
HTTP header based method overriding
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#url-based-accept-headers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
URL based accept headers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#doesnt-html5-support-put-and-delete-forms" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Doesn't HTML5 support PUT and DELETE forms?
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2826,7 +2916,7 @@ as well as how to support content types other than form-encoded data.</p>
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2718,6 +2716,171 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#third-party-packages-for-openapi-support" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Third-party packages for OpenAPI support
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Third-party packages for OpenAPI support">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-spectacular" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
drf-spectacular
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#drf-yasg" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
drf-yasg
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#built-in-openapi-schema-generation-deprecated" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Built-in OpenAPI schema generation (deprecated)
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Built-in OpenAPI schema generation (deprecated)">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#a-minimal-example-with-swagger-ui" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
A minimal example with Swagger UI
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#a-minimal-example-with-redoc" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
A minimal example with ReDoc.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#self-describing-apis" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Self describing APIs
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Self describing APIs">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setting-the-title" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setting the title
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setting-the-description" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setting the description
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-options-method" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The OPTIONS method
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-hypermedia-approach" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
The hypermedia approach
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -3009,7 +3172,7 @@ in your project's URL conf:</p>
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2668,6 +2666,121 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#rendering-html" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Rendering HTML
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#rendering-forms" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Rendering Forms
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Rendering Forms">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-template-packs" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using template packs
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Using template packs">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#rest_frameworkvertical" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
rest_framework/vertical
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#rest_frameworkhorizontal" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
rest_framework/horizontal
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#rest_frameworkinline" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
rest_framework/inline
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#field-styles" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Field styles
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -3011,7 +3124,7 @@ class ProfileDetail(APIView):
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2646,6 +2644,99 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#enabling-internationalized-apis" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Enabling internationalized APIs
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Enabling internationalized APIs">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#specifying-the-set-of-supported-languages" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Specifying the set of supported languages.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#adding-new-translations" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Adding new translations
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Adding new translations">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#translating-a-new-language-locally" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Translating a new language locally
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#how-the-language-is-determined" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
How the language is determined
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2856,7 +2947,7 @@ available for Django to use. You should see a message like <code>processing file
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2612,6 +2610,65 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#building-hypermedia-apis-with-rest-framework" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Building Hypermedia APIs with REST framework
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#what-rest-framework-provides" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
What REST framework provides.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#what-rest-framework-doesnt-provide" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
What REST framework doesn't provide.
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2757,7 +2814,7 @@ the Design of Network-based Software Architectures</a>.</li>
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -349,9 +349,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2521,6 +2519,82 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#one-to-many-data-structures" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
One-to-many data structures
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="One-to-many data structures">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#validation-errors" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Validation errors
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#adding-and-removing-items" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Adding and removing items
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#making-patch-requests" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Making PATCH requests
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2636,7 +2710,7 @@ class ToDoListSerializer(serializers.ModelSerializer):
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2689,6 +2687,142 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#introduction" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Introduction
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#setting-up-a-new-environment" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Setting up a new environment
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#getting-started" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Getting started
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#creating-a-model-to-work-with" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Creating a model to work with
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#creating-a-serializer-class" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Creating a Serializer class
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#working-with-serializers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Working with Serializers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-modelserializers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using ModelSerializers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#writing-regular-django-views-using-our-serializer" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Writing regular Django views using our Serializer
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#testing-our-first-attempt-at-a-web-api" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Testing our first attempt at a Web API
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#where-are-we-now" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Where are we now
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -3149,7 +3283,7 @@ HTTP/1.1<span class="w"> </span><span class="m">200</span><span class="w"> </spa
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2684,6 +2682,137 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#request-objects" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Request objects
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#response-objects" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Response objects
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#status-codes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Status codes
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#wrapping-api-views" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Wrapping API views
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#pulling-it-all-together" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Pulling it all together
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#adding-optional-format-suffixes-to-our-urls" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Adding optional format suffixes to our URLs
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#hows-it-looking" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
How's it looking?
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="How's it looking?">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#browsability" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Browsability
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#whats-next" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
What's next?
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2967,7 +3096,7 @@ http<span class="w"> </span>--json<span class="w"> </span>POST<span class="w"> <
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2612,6 +2610,65 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#rewriting-our-api-using-class-based-views" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Rewriting our API using class-based views
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-mixins" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using mixins
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-generic-class-based-views" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using generic class-based views
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2866,7 +2923,7 @@
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2678,6 +2676,131 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#adding-information-to-our-model" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Adding information to our model
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#adding-endpoints-for-our-user-models" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Adding endpoints for our User models
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#associating-snippets-with-users" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Associating Snippets with Users
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#updating-our-serializer" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Updating our serializer
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#adding-required-permissions-to-views" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Adding required permissions to views
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#adding-login-to-the-browsable-api" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Adding login to the Browsable API
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#object-level-permissions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Object level permissions
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#authenticating-with-the-api" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Authenticating with the API
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#summary" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Summary
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2975,7 +3098,7 @@ python<span class="w"> </span>manage.py<span class="w"> </span>migrate
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2645,6 +2643,98 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#creating-an-endpoint-for-the-root-of-our-api" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Creating an endpoint for the root of our API
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#creating-an-endpoint-for-the-highlighted-snippets" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Creating an endpoint for the highlighted snippets
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#hyperlinking-our-api" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Hyperlinking our API
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#making-sure-our-url-patterns-are-named" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Making sure our URL patterns are named
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#adding-pagination" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Adding pagination
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#browsing-the-api" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Browsing the API
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2914,7 +3004,7 @@ We'll add a url pattern for our new API root in <code>snippets/urls.py</code>:</
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2623,6 +2621,76 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#refactoring-to-use-viewsets" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Refactoring to use ViewSets
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#binding-viewsets-to-urls-explicitly" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Binding ViewSets to URLs explicitly
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-routers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Using Routers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#trade-offs-between-views-vs-viewsets" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Trade-offs between views vs ViewSets
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2849,7 +2917,7 @@ To see what's going on under the hood let's first explicitly create a set of vie
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -355,9 +355,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
|
||||
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href="../.." title="Django REST framework" class="md-nav__button md-logo" aria-label="Django REST framework" data-md-component="logo">
|
||||
|
||||
|
|
@ -2656,6 +2654,109 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#project-setup" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Project setup
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#serializers" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Serializers
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#views" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Views
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#urls" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
URLs
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#pagination" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Pagination
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#settings" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Settings
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#testing-our-api" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Testing our API
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
|
|
@ -2984,7 +3085,7 @@ http:<span class="w"> </span>password<span class="w"> </span><span class="k">for
|
|||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow", "toc.integrate"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["content.tabs.link", "content.code.annotate", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.path", "navigation.sections", "navigation.top", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user