Skip to content

Commit

Permalink
Deployed 2da473c with MkDocs version: 1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchristie committed Sep 22, 2022
1 parent e1b8627 commit c8d45f9
Show file tree
Hide file tree
Showing 78 changed files with 982 additions and 102 deletions.
4 changes: 4 additions & 0 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@
<a href="/community/release-notes/">Release Notes</a>
</li>

<li >
<a href="/community/3.14-announcement/">3.14 Announcement</a>
</li>

<li >
<a href="/community/3.13-announcement/">3.13 Announcement</a>
</li>
Expand Down
16 changes: 10 additions & 6 deletions api-guide/authentication/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>

<li >
<a href="../../community/3.14-announcement/">3.14 Announcement</a>
</li>

<li >
<a href="../../community/3.13-announcement/">3.13 Announcement</a>
</li>
Expand Down Expand Up @@ -658,8 +662,8 @@ <h2 id="tokenauthentication"><a class="toclink" href="#tokenauthentication">Toke
<hr />
<p><strong>Note:</strong> If you use <code>TokenAuthentication</code> in production you must ensure that your API is only available over <code>https</code>.</p>
<hr />
<h4 id="generating-tokens"><a class="toclink" href="#generating-tokens">Generating Tokens</a></h4>
<h5 id="by-using-signals"><a class="toclink" href="#by-using-signals">By using signals</a></h5>
<h3 id="generating-tokens"><a class="toclink" href="#generating-tokens">Generating Tokens</a></h3>
<h4 id="by-using-signals"><a class="toclink" href="#by-using-signals">By using signals</a></h4>
<p>If you want every user to have an automatically generated Token, you can simply catch the User's <code>post_save</code> signal.</p>
<pre><code>from django.conf import settings
from django.db.models.signals import post_save
Expand All @@ -679,7 +683,7 @@ <h5 id="by-using-signals"><a class="toclink" href="#by-using-signals">By using s
for user in User.objects.all():
Token.objects.get_or_create(user=user)
</code></pre>
<h5 id="by-exposing-an-api-endpoint"><a class="toclink" href="#by-exposing-an-api-endpoint">By exposing an api endpoint</a></h5>
<h4 id="by-exposing-an-api-endpoint"><a class="toclink" href="#by-exposing-an-api-endpoint">By exposing an api endpoint</a></h4>
<p>When using <code>TokenAuthentication</code>, you may want to provide a mechanism for clients to obtain a token given the username and password. REST framework provides a built-in view to provide this behaviour. To use it, add the <code>obtain_auth_token</code> view to your URLconf:</p>
<pre><code>from rest_framework.authtoken import views
urlpatterns += [
Expand Down Expand Up @@ -718,7 +722,7 @@ <h5 id="by-exposing-an-api-endpoint"><a class="toclink" href="#by-exposing-an-ap
path('api-token-auth/', CustomAuthToken.as_view())
]
</code></pre>
<h5 id="with-django-admin"><a class="toclink" href="#with-django-admin">With Django admin</a></h5>
<h4 id="with-django-admin"><a class="toclink" href="#with-django-admin">With Django admin</a></h4>
<p>It is also possible to create Tokens manually through the admin interface. In case you are using a large user base, we recommend that you monkey patch the <code>TokenAdmin</code> class customize it to your needs, more specifically by declaring the <code>user</code> field as <code>raw_field</code>.</p>
<p><code>your_app/admin.py</code>:</p>
<pre><code>from rest_framework.authtoken.admin import TokenAdmin
Expand Down Expand Up @@ -802,7 +806,7 @@ <h2 id="django-rest-knox"><a class="toclink" href="#django-rest-knox">django-res
<p><a href="https://github.com/James1345/django-rest-knox">Django-rest-knox</a> library provides models and views to handle token-based authentication in a more secure and extensible way than the built-in TokenAuthentication scheme - with Single Page Applications and Mobile clients in mind. It provides per-client tokens, and views to generate them when provided some other authentication (usually basic authentication), to delete the token (providing a server enforced logout) and to delete all tokens (logs out all clients that a user is logged into).</p>
<h2 id="django-oauth-toolkit"><a class="toclink" href="#django-oauth-toolkit">Django OAuth Toolkit</a></h2>
<p>The <a href="https://github.com/evonove/django-oauth-toolkit">Django OAuth Toolkit</a> package provides OAuth 2.0 support and works with Python 3.4+. The package is maintained by <a href="https://github.com/jazzband/">jazzband</a> and uses the excellent <a href="https://github.com/idan/oauthlib">OAuthLib</a>. The package is well documented, and well supported and is currently our <strong>recommended package for OAuth 2.0 support</strong>.</p>
<h4 id="installation-configuration"><a class="toclink" href="#installation-configuration">Installation &amp; configuration</a></h4>
<h3 id="installation-configuration"><a class="toclink" href="#installation-configuration">Installation &amp; configuration</a></h3>
<p>Install using <code>pip</code>.</p>
<pre><code>pip install django-oauth-toolkit
</code></pre>
Expand All @@ -822,7 +826,7 @@ <h4 id="installation-configuration"><a class="toclink" href="#installation-confi
<h2 id="django-rest-framework-oauth"><a class="toclink" href="#django-rest-framework-oauth">Django REST framework OAuth</a></h2>
<p>The <a href="https://jpadilla.github.io/django-rest-framework-oauth/">Django REST framework OAuth</a> package provides both OAuth1 and OAuth2 support for REST framework.</p>
<p>This package was previously included directly in the REST framework but is now supported and maintained as a third-party package.</p>
<h4 id="installation-configuration_1"><a class="toclink" href="#installation-configuration_1">Installation &amp; configuration</a></h4>
<h3 id="installation-configuration_1"><a class="toclink" href="#installation-configuration_1">Installation &amp; configuration</a></h3>
<p>Install the package using <code>pip</code>.</p>
<pre><code>pip install djangorestframework-oauth
</code></pre>
Expand Down
4 changes: 4 additions & 0 deletions api-guide/caching/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>

<li >
<a href="../../community/3.14-announcement/">3.14 Announcement</a>
</li>

<li >
<a href="../../community/3.13-announcement/">3.13 Announcement</a>
</li>
Expand Down
4 changes: 4 additions & 0 deletions api-guide/content-negotiation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>

<li >
<a href="../../community/3.14-announcement/">3.14 Announcement</a>
</li>

<li >
<a href="../../community/3.13-announcement/">3.13 Announcement</a>
</li>
Expand Down
18 changes: 18 additions & 0 deletions api-guide/exceptions/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>

<li >
<a href="../../community/3.14-announcement/">3.14 Announcement</a>
</li>

<li >
<a href="../../community/3.13-announcement/">3.13 Announcement</a>
</li>
Expand Down Expand Up @@ -486,6 +490,16 @@ <h3 id="myModalLabel">Documentation search</h3>
</li>


<li class="main">
<a href="#third-party-packages">Third party packages</a>
</li>


<li>
<a href="#drf-standardized-errors">DRF Standardized Errors</a>
</li>



<div class="promo">
<hr/>
Expand Down Expand Up @@ -682,6 +696,10 @@ <h2 id="rest_frameworkexceptionsbad_request"><a class="toclink" href="#rest_fram
<p>Set as <code>handler400</code>:</p>
<pre><code>handler400 = 'rest_framework.exceptions.bad_request'
</code></pre>
<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-standardized-errors"><a class="toclink" href="#drf-standardized-errors">DRF Standardized Errors</a></h2>
<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>


</div> <!--/span-->
Expand Down
14 changes: 4 additions & 10 deletions api-guide/fields/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>

<li >
<a href="../../community/3.14-announcement/">3.14 Announcement</a>
</li>

<li >
<a href="../../community/3.13-announcement/">3.13 Announcement</a>
</li>
Expand Down Expand Up @@ -427,10 +431,6 @@ <h3 id="myModalLabel">Documentation search</h3>
<a href="#booleanfield">BooleanField</a>
</li>

<li>
<a href="#nullbooleanfield">NullBooleanField</a>
</li>


<li class="main">
<a href="#string-fields">String fields</a>
Expand Down Expand Up @@ -741,10 +741,6 @@ <h2 id="booleanfield"><a class="toclink" href="#booleanfield">BooleanField</a></
<code>extra_kwargs</code> option to set the <code>required</code> flag.</p>
<p>Corresponds to <code>django.db.models.fields.BooleanField</code>.</p>
<p><strong>Signature:</strong> <code>BooleanField()</code></p>
<h2 id="nullbooleanfield"><a class="toclink" href="#nullbooleanfield">NullBooleanField</a></h2>
<p>A boolean representation that also accepts <code>None</code> as a valid value.</p>
<p>Corresponds to <code>django.db.models.fields.NullBooleanField</code>.</p>
<p><strong>Signature:</strong> <code>NullBooleanField()</code></p>
<hr />
<h1 id="string-fields"><a class="toclink" href="#string-fields">String fields</a></h1>
<h2 id="charfield"><a class="toclink" href="#charfield">CharField</a></h2>
Expand Down Expand Up @@ -848,8 +844,6 @@ <h4 id="example-usage"><a class="toclink" href="#example-usage">Example usage</a
<p>And to validate numbers up to anything less than one billion with a resolution of 10 decimal places:</p>
<pre><code>serializers.DecimalField(max_digits=19, decimal_places=10)
</code></pre>
<p>This field also takes an optional argument, <code>coerce_to_string</code>. If set to <code>True</code> the representation will be output as a string. If set to <code>False</code> the representation will be left as a <code>Decimal</code> instance and the final representation will be determined by the renderer.</p>
<p>If unset, this will default to the same value as the <code>COERCE_DECIMAL_TO_STRING</code> setting, which is <code>True</code> unless set otherwise.</p>
<hr />
<h1 id="date-and-time-fields"><a class="toclink" href="#date-and-time-fields">Date and time fields</a></h1>
<h2 id="datetimefield"><a class="toclink" href="#datetimefield">DateTimeField</a></h2>
Expand Down
4 changes: 4 additions & 0 deletions api-guide/filtering/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>

<li >
<a href="../../community/3.14-announcement/">3.14 Announcement</a>
</li>

<li >
<a href="../../community/3.13-announcement/">3.13 Announcement</a>
</li>
Expand Down
4 changes: 4 additions & 0 deletions api-guide/format-suffixes/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>

<li >
<a href="../../community/3.14-announcement/">3.14 Announcement</a>
</li>

<li >
<a href="../../community/3.13-announcement/">3.13 Announcement</a>
</li>
Expand Down
10 changes: 7 additions & 3 deletions api-guide/generic-views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>

<li >
<a href="../../community/3.14-announcement/">3.14 Announcement</a>
</li>

<li >
<a href="../../community/3.13-announcement/">3.13 Announcement</a>
</li>
Expand Down Expand Up @@ -596,7 +600,7 @@ <h3 id="attributes"><a class="toclink" href="#attributes">Attributes</a></h3>
<ul>
<li><code>queryset</code> - The queryset that should be used for returning objects from this view. Typically, you must either set this attribute, or override the <code>get_queryset()</code> method. If you are overriding a view method, it is important that you call <code>get_queryset()</code> instead of accessing this property directly, as <code>queryset</code> will get evaluated once, and those results will be cached for all subsequent requests.</li>
<li><code>serializer_class</code> - The serializer class that should be used for validating and deserializing input, and for serializing output. Typically, you must either set this attribute, or override the <code>get_serializer_class()</code> method.</li>
<li><code>lookup_field</code> - The model field that should be used to for performing object lookup of individual model instances. Defaults to <code>'pk'</code>. Note that when using hyperlinked APIs you'll need to ensure that <em>both</em> the API views <em>and</em> the serializer classes set the lookup fields if you need to use a custom value.</li>
<li><code>lookup_field</code> - The model field that should be used for performing object lookup of individual model instances. Defaults to <code>'pk'</code>. Note that when using hyperlinked APIs you'll need to ensure that <em>both</em> the API views <em>and</em> the serializer classes set the lookup fields if you need to use a custom value.</li>
<li><code>lookup_url_kwarg</code> - The URL keyword argument that should be used for object lookup. The URL conf should include a keyword argument corresponding to this value. If unset this defaults to using the same value as <code>lookup_field</code>.</li>
</ul>
<p><strong>Pagination</strong>:</p>
Expand Down Expand Up @@ -707,7 +711,7 @@ <h2 id="createmodelmixin"><a class="toclink" href="#createmodelmixin">CreateMode
<p>If the request data provided for creating the object was invalid, a <code>400 Bad Request</code> response will be returned, with the error details as the body of the response.</p>
<h2 id="retrievemodelmixin"><a class="toclink" href="#retrievemodelmixin">RetrieveModelMixin</a></h2>
<p>Provides a <code>.retrieve(request, *args, **kwargs)</code> method, that implements returning an existing model instance in a response.</p>
<p>If an object can be retrieved this returns a <code>200 OK</code> response, with a serialized representation of the object as the body of the response. Otherwise it will return a <code>404 Not Found</code>.</p>
<p>If an object can be retrieved this returns a <code>200 OK</code> response, with a serialized representation of the object as the body of the response. Otherwise, it will return a <code>404 Not Found</code>.</p>
<h2 id="updatemodelmixin"><a class="toclink" href="#updatemodelmixin">UpdateModelMixin</a></h2>
<p>Provides a <code>.update(request, *args, **kwargs)</code> method, that implements updating and saving an existing model instance.</p>
<p>Also provides a <code>.partial_update(request, *args, **kwargs)</code> method, which is similar to the <code>update</code> method, except that all fields for the update will be optional. This allows support for HTTP <code>PATCH</code> requests.</p>
Expand Down Expand Up @@ -771,7 +775,7 @@ <h2 id="creating-custom-mixins"><a class="toclink" href="#creating-custom-mixins
queryset = self.filter_queryset(queryset) # Apply any filter backends
filter = {}
for field in self.lookup_fields:
if self.kwargs[field]: # Ignore empty fields.
if self.kwargs.get(field): # Ignore empty fields.
filter[field] = self.kwargs[field]
obj = get_object_or_404(queryset, **filter) # Lookup the object
self.check_object_permissions(self.request, obj)
Expand Down
4 changes: 4 additions & 0 deletions api-guide/metadata/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>

<li >
<a href="../../community/3.14-announcement/">3.14 Announcement</a>
</li>

<li >
<a href="../../community/3.13-announcement/">3.13 Announcement</a>
</li>
Expand Down
4 changes: 4 additions & 0 deletions api-guide/pagination/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>

<li >
<a href="../../community/3.14-announcement/">3.14 Announcement</a>
</li>

<li >
<a href="../../community/3.13-announcement/">3.13 Announcement</a>
</li>
Expand Down
4 changes: 4 additions & 0 deletions api-guide/parsers/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>

<li >
<a href="../../community/3.14-announcement/">3.14 Announcement</a>
</li>

<li >
<a href="../../community/3.13-announcement/">3.13 Announcement</a>
</li>
Expand Down
6 changes: 5 additions & 1 deletion api-guide/permissions/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@
<a href="../../community/release-notes/">Release Notes</a>
</li>

<li >
<a href="../../community/3.14-announcement/">3.14 Announcement</a>
</li>

<li >
<a href="../../community/3.13-announcement/">3.13 Announcement</a>
</li>
Expand Down Expand Up @@ -656,7 +660,7 @@ <h2 id="isauthenticatedorreadonly"><a class="toclink" href="#isauthenticatedorre
<p>The <code>IsAuthenticatedOrReadOnly</code> will allow authenticated users to perform any request. Requests for unauthorised 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"><a class="toclink" href="#djangomodelpermissions">DjangoModelPermissions</a></h2>
<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.</p>
<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>
<li><code>PUT</code> and <code>PATCH</code> requests require the user to have the <code>change</code> permission on the model.</li>
Expand Down
Loading

0 comments on commit c8d45f9

Please sign in to comment.