Deployed 0e1c5d31 with MkDocs version: 1.0.4

This commit is contained in:
Tom Christie 2019-07-29 13:57:14 +00:00
parent de92c150b9
commit b9719fc763
12 changed files with 86 additions and 74 deletions

View File

@ -755,7 +755,7 @@ already exist. To change this and other behaviour, consult the
<p>You <em>may</em> also override the <code>.authenticate_header(self, request)</code> method. If implemented, it should return a string that will be used as the value of the <code>WWW-Authenticate</code> header in a <code>HTTP 401 Unauthorized</code> response.</p>
<p>If the <code>.authenticate_header()</code> method is not overridden, the authentication scheme will return <code>HTTP 403 Forbidden</code> responses when an unauthenticated request is denied access.</p>
<hr />
<p><strong>Note:</strong> When your custom authenticator is invoked by the request object's <code>.user</code> or <code>.auth</code> properties, you may see an <code>AttributeError</code> re-raised as a <code>WrappedAttributeError</code>. This is necessary to prevent the original exception from being suppressed by the outer property access. Python will not recognize that the <code>AttributeError</code> orginates from your custom authenticator and will instead assume that the request object does not have a <code>.user</code> or <code>.auth</code> property. These errors should be fixed or otherwise handled by your authenticator.</p>
<p><strong>Note:</strong> When your custom authenticator is invoked by the request object's <code>.user</code> or <code>.auth</code> properties, you may see an <code>AttributeError</code> re-raised as a <code>WrappedAttributeError</code>. This is necessary to prevent the original exception from being suppressed by the outer property access. Python will not recognize that the <code>AttributeError</code> originates from your custom authenticator and will instead assume that the request object does not have a <code>.user</code> or <code>.auth</code> property. These errors should be fixed or otherwise handled by your authenticator.</p>
<hr />
<h2 id="example"><a class="toclink" href="#example">Example</a></h2>
<p>The following example will authenticate any incoming request as the user given by the username in a custom request header named 'X-USERNAME'.</p>

View File

@ -681,7 +681,7 @@ class UserListView(generics.ListAPIView):
<p>For example:</p>
<pre><code>search_fields = ['=username', '=email']
</code></pre>
<p>By default, the search parameter is named <code>'search</code>', but this may be overridden with the <code>SEARCH_PARAM</code> setting.</p>
<p>By default, the search parameter is named <code>'search'</code>, but this may be overridden with the <code>SEARCH_PARAM</code> setting.</p>
<p>To dynamically change search fields based on request content, it's possible to subclass the <code>SearchFilter</code> and override the <code>get_search_fields()</code> function. For example, the following subclass will only search on <code>title</code> if the query parameter <code>title_only</code> is in the request:</p>
<pre><code>from rest_framework import filters

View File

@ -725,7 +725,7 @@ class BlacklistPermission(permissions.BasePermission):
<h1 id="third-party-packages"><a class="toclink" href="#third-party-packages">Third party packages</a></h1>
<p>The following third party packages are also available.</p>
<h2 id="drf-access-policy"><a class="toclink" href="#drf-access-policy">DRF - Access Policy</a></h2>
<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 declaritive 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 &amp; Access Management policies. </p>
<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 &amp; Access Management policies. </p>
<h2 id="composed-permissions"><a class="toclink" href="#composed-permissions">Composed Permissions</a></h2>
<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"><a class="toclink" href="#rest-condition">REST Condition</a></h2>

View File

@ -553,7 +553,7 @@
<p>The <code>APIView</code> class or <code>@api_view</code> decorator will ensure that this property is automatically set to a list of <code>Authentication</code> instances, based on the <code>authentication_classes</code> set on the view or based on the <code>DEFAULT_AUTHENTICATORS</code> setting.</p>
<p>You won't typically need to access this property.</p>
<hr />
<p><strong>Note:</strong> You may see a <code>WrappedAttributeError</code> raised when calling the <code>.user</code> or <code>.auth</code> properties. These errors originate from an authenticator as a standard <code>AttributeError</code>, however it's necessary that they be re-raised as a different exception type in order to prevent them from being suppressed by the outer property access. Python will not recognize that the <code>AttributeError</code> orginates from the authenticator and will 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>
<p><strong>Note:</strong> You may see a <code>WrappedAttributeError</code> raised when calling the <code>.user</code> or <code>.auth</code> properties. These errors originate from an authenticator as a standard <code>AttributeError</code>, however it's necessary that they be re-raised as a different exception type in order to prevent them from being suppressed by the outer property access. Python will not recognize that the <code>AttributeError</code> 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>
<hr />
<h1 id="browser-enhancements"><a class="toclink" href="#browser-enhancements">Browser enhancements</a></h1>
<p>REST framework supports a few browser enhancements such as browser-based <code>PUT</code>, <code>PATCH</code> and <code>DELETE</code> forms.</p>

View File

@ -1374,7 +1374,7 @@ def all_high_scores(request):
into primitive representations.
"""
def to_representation(self, obj):
output = {}
output = {}
for attribute_name in dir(obj):
attribute = getattr(obj, attribute_name)
if attribute_name.startswith('_'):
@ -1400,7 +1400,7 @@ def all_high_scores(request):
else:
# Force anything else to its string representation.
output[attribute_name] = str(attribute)
return output
return output
</code></pre>
<hr />
<h1 id="advanced-serializer-usage"><a class="toclink" href="#advanced-serializer-usage">Advanced serializer usage</a></h1>

View File

@ -509,6 +509,18 @@
</code></pre>
<hr />
<h2 id="310x-series"><a class="toclink" href="#310x-series">3.10.x series</a></h2>
<h3 id="3102"><a class="toclink" href="#3102">3.10.2</a></h3>
<p><strong>Date</strong>: 29th July 2019</p>
<ul>
<li>Various <code>OpenAPI</code> schema fixes.</li>
<li>Ability to specify urlconf in include_docs_urls.</li>
</ul>
<h3 id="3101"><a class="toclink" href="#3101">3.10.1</a></h3>
<p><strong>Date</strong>: 17th July 2019</p>
<ul>
<li>Don't include autocomplete fields on TokenAuth admin, since it forces constraints on custom user models &amp; admin.</li>
<li>Require <code>uritemplate</code> for OpenAPI schema generation, but not <code>coreapi</code>.</li>
</ul>
<h3 id="3100"><a class="toclink" href="#3100">3.10.0</a></h3>
<p><strong>Date</strong>: <a href="https://github.com/encode/django-rest-framework/milestone/69?closed=1">15th July 2019</a></p>
<ul>

View File

@ -469,7 +469,7 @@ version (default is "0.1.0")?
<h4 id="adding-to-travis-ci"><a class="toclink" href="#adding-to-travis-ci">Adding to Travis CI</a></h4>
<p>We recommend using <a href="https://travis-ci.org">Travis CI</a>, a hosted continuous integration service which integrates well with GitHub and is free for public repositories.</p>
<p>To get started with Travis CI, <a href="https://travis-ci.org">sign in</a> with your GitHub account. Once you're signed in, go to your <a href="https://travis-ci.org/profile">profile page</a> and enable the service hook for the repository you want.</p>
<p>If you use the cookiecutter template, your project will already contain a <code>.travis.yml</code> file which Travis CI will use to build your project and run tests. By default, builds are triggered everytime you push to your repository or create Pull Request.</p>
<p>If you use the cookiecutter template, your project will already contain a <code>.travis.yml</code> file which Travis CI will use to build your project and run tests. By default, builds are triggered every time you push to your repository or create Pull Request.</p>
<h4 id="uploading-to-pypi"><a class="toclink" href="#uploading-to-pypi">Uploading to PyPI</a></h4>
<p>Once you've got at least a prototype working and tests running, you should publish it on PyPI to allow others to install it via <code>pip</code>.</p>
<p>You must <a href="https://pypi.org/account/register/">register</a> an account before publishing to PyPI.</p>

View File

@ -952,7 +952,7 @@ populate descriptions in the schema document.</p>
usernames = [user.username for user in User.objects.all()]
return Response(usernames)
</code></pre>
<p>A <code>ViewSet</code>, with an explict action docstring.</p>
<p>A <code>ViewSet</code>, with an explicit action docstring.</p>
<pre><code>class ListUsernames(ViewSet):
def list(self, request):
"""

File diff suppressed because one or more lines are too long

View File

@ -2,322 +2,322 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.django-rest-framework.org/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/tutorial/quickstart/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/tutorial/1-serialization/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/tutorial/2-requests-and-responses/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/tutorial/3-class-based-views/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/tutorial/4-authentication-and-permissions/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/tutorial/5-relationships-and-hyperlinked-apis/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/requests/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/responses/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/views/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/generic-views/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/viewsets/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/routers/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/parsers/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/renderers/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/serializers/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/fields/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/relations/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/validators/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/authentication/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/permissions/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/caching/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/throttling/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/filtering/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/pagination/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/versioning/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/content-negotiation/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/metadata/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/schemas/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/format-suffixes/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/reverse/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/exceptions/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/status-codes/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/testing/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/api-guide/settings/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/topics/documenting-your-api/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/topics/api-clients/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/topics/internationalization/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/topics/ajax-csrf-cors/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/topics/html-and-forms/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/topics/browser-enhancements/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/topics/browsable-api/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/topics/rest-hypermedia-hateoas/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/tutorials-and-resources/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/third-party-packages/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/contributing/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/project-management/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/release-notes/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.10-announcement/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.9-announcement/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.8-announcement/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.7-announcement/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.6-announcement/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.5-announcement/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.4-announcement/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.3-announcement/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.2-announcement/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.1-announcement/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/3.0-announcement/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/kickstarter-announcement/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/mozilla-grant/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/funding/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.django-rest-framework.org/community/jobs/</loc>
<lastmod>2019-07-17</lastmod>
<lastmod>2019-07-29</lastmod>
<changefreq>daily</changefreq>
</url>
</urlset>

Binary file not shown.

View File

@ -446,7 +446,7 @@ can be used with tools that allow you to build API documentation.</p>
<p>There are also a number of great third-party documentation packages available.</p>
<h2 id="generating-documentation-from-openapi-schemas"><a class="toclink" href="#generating-documentation-from-openapi-schemas">Generating documentation from OpenAPI schemas</a></h2>
<p>There are a number of packages available that allow you to generate HTML
documenation pages from OpenAPI schemas.</p>
documentation pages from OpenAPI schemas.</p>
<p>Two popular options are <a href="https://swagger.io/tools/swagger-ui/">Swagger UI</a> and <a href="https://github.com/Rebilly/ReDoc">ReDoc</a>.</p>
<p>Both require little more than the location of your static schema file or
dynamic <code>SchemaView</code> endpoint.</p>