mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-29 13:04:03 +03:00
Deployed c05998f5
with MkDocs version: 1.1.2
This commit is contained in:
parent
dee977cf98
commit
469ca95e6b
|
@ -683,7 +683,12 @@ Set to false if this field is not required to be present during deserialization.
|
|||
<p>Note that, without an explicit <code>default</code>, setting this argument to <code>True</code> will imply a <code>default</code> value of <code>null</code> for serialization output, but does not imply a default for input deserialization.</p>
|
||||
<p>Defaults to <code>False</code></p>
|
||||
<h3 id="source"><a class="toclink" href="#source"><code>source</code></a></h3>
|
||||
<p>The name of the attribute that will be used to populate the field. May be a method that only takes a <code>self</code> argument, such as <code>URLField(source='get_absolute_url')</code>, or may use dotted notation to traverse attributes, such as <code>EmailField(source='user.email')</code>. When serializing fields with dotted notation, it may be necessary to provide a <code>default</code> value if any object is not present or is empty during attribute traversal.</p>
|
||||
<p>The name of the attribute that will be used to populate the field. May be a method that only takes a <code>self</code> argument, such as <code>URLField(source='get_absolute_url')</code>, or may use dotted notation to traverse attributes, such as <code>EmailField(source='user.email')</code>. </p>
|
||||
<p>When serializing fields with dotted notation, it may be necessary to provide a <code>default</code> value if any object is not present or is empty during attribute traversal. Beware of possible n+1 problems when using source attribute if you are accessing a relational orm model. For example:</p>
|
||||
<pre><code>class CommentSerializer(serializers.Serializer):
|
||||
email = serializers.EmailField(source="user.email")
|
||||
</code></pre>
|
||||
<p>would require user object to be fetched from database when it is not prefetched. If that is not wanted, be sure to be using <code>prefetch_related</code> and <code>select_related</code> methods appropriately. For more information about the methods refer to <a href="https://docs.djangoproject.com/en/3.1/ref/models/querysets/#django.db.models.query.QuerySet.select_related">django documentation</a>.</p>
|
||||
<p>The value <code>source='*'</code> has a special meaning, and is used to indicate that the entire object should be passed through to the field. This can be useful for creating nested representations, or for fields which require access to the complete object in order to determine the output representation.</p>
|
||||
<p>Defaults to the name of the field.</p>
|
||||
<h3 id="validators"><a class="toclink" href="#validators"><code>validators</code></a></h3>
|
||||
|
@ -850,7 +855,7 @@ explicitly declare the <code>BooleanField</code> on the serializer class, or use
|
|||
<ul>
|
||||
<li><code>format</code> - A string representing the output format. If not specified, this defaults to the same value as the <code>DATETIME_FORMAT</code> settings key, which will be <code>'iso-8601'</code> unless set. Setting to a format string indicates that <code>to_representation</code> return values should be coerced to string output. Format strings are described below. Setting this value to <code>None</code> indicates that Python <code>datetime</code> objects should be returned by <code>to_representation</code>. In this case the datetime encoding will be determined by the renderer.</li>
|
||||
<li><code>input_formats</code> - A list of strings representing the input formats which may be used to parse the date. If not specified, the <code>DATETIME_INPUT_FORMATS</code> setting will be used, which defaults to <code>['iso-8601']</code>.</li>
|
||||
<li><code>default_timezone</code> - A <code>pytz.timezone</code> representing the timezone. If not specified and the <code>USE_TZ</code> setting is enabled, this defaults to the <a href="https://docs.djangoproject.com/en/stable/topics/i18n/timezones/#default-time-zone-and-current-time-zone">current timezone</a>. If <code>USE_TZ</code> is disabled, then datetime objects will be naive.</li>
|
||||
<li><code>default_timezone</code> - A <code>tzinfo</code> subclass (<code>zoneinfo</code> or <code>pytz</code>) prepresenting the timezone. If not specified and the <code>USE_TZ</code> setting is enabled, this defaults to the <a href="https://docs.djangoproject.com/en/stable/topics/i18n/timezones/#default-time-zone-and-current-time-zone">current timezone</a>. If <code>USE_TZ</code> is disabled, then datetime objects will be naive.</li>
|
||||
</ul>
|
||||
<h4 id="datetimefield-format-strings"><a class="toclink" href="#datetimefield-format-strings"><code>DateTimeField</code> format strings.</a></h4>
|
||||
<p>Format strings may either be <a href="https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior">Python strftime formats</a> which explicitly specify the format, or the special string <code>'iso-8601'</code>, which indicates that <a href="https://www.w3.org/TR/NOTE-datetime">ISO 8601</a> style datetimes should be used. (eg <code>'2013-01-29T12:34:56.000000Z'</code>)</p>
|
||||
|
|
|
@ -703,7 +703,7 @@ class CustomSearchFilter(filters.SearchFilter):
|
|||
def get_search_fields(self, view, request):
|
||||
if request.query_params.get('title_only'):
|
||||
return ['title']
|
||||
return super(CustomSearchFilter, self).get_search_fields(view, request)
|
||||
return super().get_search_fields(view, request)
|
||||
</code></pre>
|
||||
<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 />
|
||||
|
|
|
@ -615,6 +615,9 @@ class UserList(generics.ListCreateAPIView):
|
|||
user = self.request.user
|
||||
return user.accounts.all()
|
||||
</code></pre>
|
||||
<hr />
|
||||
<p><strong>Note:</strong> If the serializer_class used in the generic view spans orm relations, leading to an n+1 problem, you could optimize your queryset in this method using <code>select_related</code> and <code>prefetch_related</code>. To get more information about n+1 problem and use cases of the mentioned methods refer to related section in <a href="https://docs.djangoproject.com/en/3.1/ref/models/querysets/#django.db.models.query.QuerySet.select_related">django documentation</a>.</p>
|
||||
<hr />
|
||||
<h4 id="get_objectself"><a class="toclink" href="#get_objectself"><code>get_object(self)</code></a></h4>
|
||||
<p>Returns an object instance that should be used for detail views. Defaults to using the <code>lookup_field</code> parameter to filter the base queryset.</p>
|
||||
<p>May be overridden to provide more complex behavior, such as object lookups based on more than one URL kwarg.</p>
|
||||
|
|
|
@ -729,7 +729,7 @@ that REST framework provides, by implementing a <code>get_schema_fields()</code>
|
|||
<h2 id="drf-proxy-pagination"><a class="toclink" href="#drf-proxy-pagination">drf-proxy-pagination</a></h2>
|
||||
<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"><a class="toclink" href="#link-header-pagination">link-header-pagination</a></h2>
|
||||
<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="github-link-pagination">Github's developer documentation</a>.</p>
|
||||
<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>
|
||||
|
||||
|
||||
</div> <!--/span-->
|
||||
|
|
|
@ -543,8 +543,8 @@
|
|||
<h2 id="how-permissions-are-determined"><a class="toclink" href="#how-permissions-are-determined">How permissions are determined</a></h2>
|
||||
<p>Permissions in REST framework are always defined as a list of permission classes.</p>
|
||||
<p>Before running the main body of the view each permission in the list is checked.
|
||||
If any permission check fails an <code>exceptions.PermissionDenied</code> or <code>exceptions.NotAuthenticated</code> exception will be raised, and the main body of the view will not run.</p>
|
||||
<p>When the permissions checks fail either a "403 Forbidden" or a "401 Unauthorized" response will be returned, according to the following rules:</p>
|
||||
If any permission check fails, an <code>exceptions.PermissionDenied</code> or <code>exceptions.NotAuthenticated</code> exception will be raised, and the main body of the view will not run.</p>
|
||||
<p>When the permission checks fail, either a "403 Forbidden" or a "401 Unauthorized" response will be returned, according to the following rules:</p>
|
||||
<ul>
|
||||
<li>The request was successfully authenticated, but permission was denied. <em>— An HTTP 403 Forbidden response will be returned.</em></li>
|
||||
<li>The request was not successfully authenticated, and the highest priority authentication class <em>does not</em> use <code>WWW-Authenticate</code> headers. <em>— An HTTP 403 Forbidden response will be returned.</em></li>
|
||||
|
@ -753,7 +753,7 @@ class BlocklistPermission(permissions.BasePermission):
|
|||
<tr>
|
||||
<td>Action: list</td>
|
||||
<td>global</td>
|
||||
<td>no</td>
|
||||
<td>global</td>
|
||||
<td>object-level*</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -547,6 +547,31 @@
|
|||
<hr />
|
||||
<p><strong>Note:</strong> The relational fields are declared in <code>relations.py</code>, but by convention you should import them from the <code>serializers</code> module, using <code>from rest_framework import serializers</code> and refer to fields as <code>serializers.<FieldName></code>.</p>
|
||||
<hr />
|
||||
<hr />
|
||||
<p><strong>Note:</strong> REST Framework does not attempt to automatically optimize querysets passed to serializers in terms of <code>select_related</code> and <code>prefetch_related</code> since it would be too much magic. A serializer with a field spanning an orm relation through its source attribute could require an additional database hit to fetch related object from the database. It is the programmer's responsibility to optimize queries to avoid additional database hits which could occur while using such a serializer.</p>
|
||||
<p>For example, the following serializer would lead to a database hit each time evaluating the tracks field if it is not prefetched:</p>
|
||||
<pre><code>class AlbumSerializer(serializers.ModelSerializer):
|
||||
tracks = serializers.SlugRelatedField(
|
||||
many=True,
|
||||
read_only=True,
|
||||
slug_field='title'
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = Album
|
||||
fields = ['album_name', 'artist', 'tracks']
|
||||
|
||||
# For each album object, tracks should be fetched from database
|
||||
qs = Album.objects.all()
|
||||
print(AlbumSerializer(qs, many=True).data)
|
||||
</code></pre>
|
||||
<p>If <code>AlbumSerializer</code> is used to serialize a fairly large queryset with <code>many=True</code> then it could be a serious performance problem. Optimizing the queryset passed to <code>AlbumSerializer</code> with:</p>
|
||||
<pre><code>qs = Album.objects.prefetch_related('tracks')
|
||||
# No additional database hits required
|
||||
print(AlbumSerializer(qs, many=True).data)
|
||||
</code></pre>
|
||||
<p>would solve the issue.</p>
|
||||
<hr />
|
||||
<h4 id="inspecting-relationships"><a class="toclink" href="#inspecting-relationships">Inspecting relationships.</a></h4>
|
||||
<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>
|
||||
|
|
|
@ -519,6 +519,14 @@
|
|||
<a href="#allow_empty">allow_empty</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#max_length">max_length</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#min_length">min_length</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#customizing-listserializer-behavior">Customizing ListSerializer behavior</a>
|
||||
</li>
|
||||
|
@ -741,7 +749,7 @@ serializer = CommentSerializer(data=data)
|
|||
# .save() will update the existing `comment` instance.
|
||||
serializer = CommentSerializer(comment, data=data)
|
||||
</code></pre>
|
||||
<p>Both the <code>.create()</code> and <code>.update()</code> methods are optional. You can implement either neither, one, or both of them, depending on the use-case for your serializer class.</p>
|
||||
<p>Both the <code>.create()</code> and <code>.update()</code> methods are optional. You can implement either none, one, or both of them, depending on the use-case for your serializer class.</p>
|
||||
<h4 id="passing-additional-attributes-to-save"><a class="toclink" href="#passing-additional-attributes-to-save">Passing additional attributes to <code>.save()</code></a></h4>
|
||||
<p>Sometimes you'll want your view code to be able to inject additional data at the point of saving the instance. This additional data might include information like the current user, the current time, or anything else that is not part of the request data.</p>
|
||||
<p>You can do so by including additional keyword arguments when calling <code>.save()</code>. For example:</p>
|
||||
|
@ -1204,6 +1212,10 @@ in the serializer context.</p>
|
|||
<p>The following argument can also be passed to a <code>ListSerializer</code> field or a serializer that is passed <code>many=True</code>:</p>
|
||||
<h3 id="allow_empty"><a class="toclink" href="#allow_empty"><code>allow_empty</code></a></h3>
|
||||
<p>This is <code>True</code> by default, but can be set to <code>False</code> if you want to disallow empty lists as valid input.</p>
|
||||
<h3 id="max_length"><a class="toclink" href="#max_length"><code>max_length</code></a></h3>
|
||||
<p>This is <code>None</code> by default, but can be set to a positive integer if you want to validates that the list contains no more than this number of elements.</p>
|
||||
<h3 id="min_length"><a class="toclink" href="#min_length"><code>min_length</code></a></h3>
|
||||
<p>This is <code>None</code> by default, but can be set to a positive integer if you want to validates that the list contains no fewer than this number of elements.</p>
|
||||
<h3 id="customizing-listserializer-behavior"><a class="toclink" href="#customizing-listserializer-behavior">Customizing <code>ListSerializer</code> behavior</a></h3>
|
||||
<p>There <em>are</em> a few use cases when you might want to customize the <code>ListSerializer</code> behavior. For example:</p>
|
||||
<ul>
|
||||
|
@ -1483,7 +1495,7 @@ class MySerializer(MyBaseSerializer):
|
|||
fields = kwargs.pop('fields', None)
|
||||
|
||||
# Instantiate the superclass normally
|
||||
super(DynamicFieldsModelSerializer, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
if fields is not None:
|
||||
# Drop any fields that are not specified in the `fields` argument.
|
||||
|
|
|
@ -713,7 +713,7 @@ client.headers.update({'x-test': 'true'})
|
|||
<p>If you're using <code>SessionAuthentication</code> then you'll need to include a CSRF token
|
||||
for any <code>POST</code>, <code>PUT</code>, <code>PATCH</code> or <code>DELETE</code> requests.</p>
|
||||
<p>You can do so by following the same flow that a JavaScript based client would use.
|
||||
First make a <code>GET</code> request in order to obtain a CRSF token, then present that
|
||||
First, make a <code>GET</code> request in order to obtain a CSRF token, then present that
|
||||
token in the following request.</p>
|
||||
<p>For example...</p>
|
||||
<pre><code>client = RequestsClient()
|
||||
|
@ -734,7 +734,7 @@ assert response.status_code == 200
|
|||
<p>With careful usage both the <code>RequestsClient</code> and the <code>CoreAPIClient</code> provide
|
||||
the ability to write test cases that can run either in development, or be run
|
||||
directly against your staging server or production environment.</p>
|
||||
<p>Using this style to create basic tests of a few core piece of functionality is
|
||||
<p>Using this style to create basic tests of a few core pieces of functionality is
|
||||
a powerful way to validate your live service. Doing so may require some careful
|
||||
attention to setup and teardown to ensure that the tests run in a way that they
|
||||
do not directly affect customer data.</p>
|
||||
|
|
|
@ -558,6 +558,7 @@ This method is used to enforce permissions and throttling, and perform content n
|
|||
<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>
|
||||
<pre><code>from rest_framework.decorators import api_view
|
||||
from rest_framework.response import Response
|
||||
|
||||
@api_view()
|
||||
def hello_world(request):
|
||||
|
|
|
@ -587,7 +587,7 @@ urlpatterns = router.urls
|
|||
if self.action == 'list':
|
||||
permission_classes = [IsAuthenticated]
|
||||
else:
|
||||
permission_classes = [IsAdmin]
|
||||
permission_classes = [IsAdminUser]
|
||||
return [permission() for permission in permission_classes]
|
||||
</code></pre>
|
||||
<h2 id="marking-extra-actions-for-routing"><a class="toclink" href="#marking-extra-actions-for-routing">Marking extra actions for routing</a></h2>
|
||||
|
|
|
@ -540,7 +540,7 @@ that uses an API schema to automatically provide a client library interface for
|
|||
<h2 id="composable-permission-classes"><a class="toclink" href="#composable-permission-classes">Composable permission classes</a></h2>
|
||||
<p>You can now compose permission classes using the and/or operators, <code>&</code> and <code>|</code>.</p>
|
||||
<p>For example...</p>
|
||||
<pre><code class="language-python">permission_classes = [IsAuthenticated & (ReadOnly | IsAdmin)]
|
||||
<pre><code class="language-python">permission_classes = [IsAuthenticated & (ReadOnly | IsAdminUser)]
|
||||
</code></pre>
|
||||
<p>If you're using custom permission classes then make sure that you are subclassing
|
||||
from <code>BasePermission</code> in order to enable this support.</p>
|
||||
|
|
|
@ -522,6 +522,7 @@
|
|||
<li><a href="https://github.com/juanriaza/django-rest-framework-msgpack">djangorestframework-msgpack</a> - Provides MessagePack renderer and parser support.</li>
|
||||
<li><a href="https://github.com/django-json-api/django-rest-framework-json-api">djangorestframework-jsonapi</a> - Provides a parser, renderer, serializers, and other tools to help build an API that is compliant with the jsonapi.org spec.</li>
|
||||
<li><a href="https://github.com/vbabiy/djangorestframework-camel-case">djangorestframework-camel-case</a> - Provides camel case JSON renderers and parsers.</li>
|
||||
<li><a href="https://github.com/remigermain/nested-multipart-parser">nested-multipart-parser</a> - Provides nested parser for http multipart request</li>
|
||||
</ul>
|
||||
<h3 id="renderers"><a class="toclink" href="#renderers">Renderers</a></h3>
|
||||
<ul>
|
||||
|
|
|
@ -449,6 +449,14 @@
|
|||
|
||||
|
||||
<h1 id="tutorial-7-schemas-client-libraries"><a class="toclink" href="#tutorial-7-schemas-client-libraries">Tutorial 7: Schemas & client libraries</a></h1>
|
||||
<hr />
|
||||
<p><strong>DEPRECATION NOTICE:</strong> Use of CoreAPI-based schemas were deprecated with the introduction of native OpenAPI-based schema generation as of Django REST Framework v3.10. See the <a href="../../community/3.10-announcement/">Version 3.10 Release Announcement</a> for more details.</p>
|
||||
<p>If you are looking for information regarding schemas, you might want to look at these updated resources:</p>
|
||||
<ol>
|
||||
<li><a href="../../api-guide/schemas/">Schema</a></li>
|
||||
<li><a href="../../topics/documenting-your-api/">Documenting your API</a></li>
|
||||
</ol>
|
||||
<hr />
|
||||
<p>A schema is a machine-readable document that describes the available API
|
||||
endpoints, their URLS, and what operations they support.</p>
|
||||
<p>Schemas can be a useful tool for auto-generated documentation, and can also
|
||||
|
|
|
@ -441,6 +441,14 @@
|
|||
|
||||
|
||||
<h2 id="built-in-api-documentation"><a class="toclink" href="#built-in-api-documentation">Built-in API documentation</a></h2>
|
||||
<hr />
|
||||
<p><strong>DEPRECATION NOTICE:</strong> Use of CoreAPI-based schemas were deprecated with the introduction of native OpenAPI-based schema generation as of Django REST Framework v3.10. See the <a href="../../community/3.10-announcement/">Version 3.10 Release Announcement</a> for more details.</p>
|
||||
<p>If you are looking for information regarding schemas, you might want to look at these updated resources:</p>
|
||||
<ol>
|
||||
<li><a href="../../api-guide/schemas/">Schema</a></li>
|
||||
<li><a href="../../topics/documenting-your-api/">Documenting your API</a></li>
|
||||
</ol>
|
||||
<hr />
|
||||
<p>The built-in API documentation includes:</p>
|
||||
<ul>
|
||||
<li>Documentation of API endpoints.</li>
|
||||
|
|
|
@ -425,8 +425,8 @@
|
|||
|
||||
|
||||
<h1 id="legacy-coreapi-schemas-docs"><a class="toclink" href="#legacy-coreapi-schemas-docs">Legacy CoreAPI Schemas Docs</a></h1>
|
||||
<p>Use of CoreAPI-based schemas were deprecated with the introduction of native OpenAPI-based schema generation in Django REST Framework v3.10.</p>
|
||||
<p>See the <a href="/community/3.10-announcement.md">Version 3.10 Release Announcement</a> for more details.</p>
|
||||
<p>Use of CoreAPI-based schemas were deprecated with the introduction of native OpenAPI-based schema generation as of Django REST Framework v3.10.</p>
|
||||
<p>See the <a href="../community/3.10-announcement/">Version 3.10 Release Announcement</a> for more details.</p>
|
||||
<hr />
|
||||
<p>You can continue to use CoreAPI schemas by setting the appropriate default schema class:</p>
|
||||
<pre><code class="language-python"># In settings.py
|
||||
|
|
|
@ -569,6 +569,10 @@
|
|||
|
||||
|
||||
<h1 id="schemas"><a class="toclink" href="#schemas">Schemas</a></h1>
|
||||
<hr />
|
||||
<p><strong>DEPRECATION NOTICE:</strong> Use of CoreAPI-based schemas were deprecated with the introduction of native OpenAPI-based schema generation as of Django REST Framework v3.10. See the <a href="../../community/3.10-announcement/">Version 3.10 Release Announcement</a> for more details.</p>
|
||||
<p>You are probably looking for <a href="../../api-guide/schemas/">this page</a> if you want latest information regarding schemas.</p>
|
||||
<hr />
|
||||
<blockquote>
|
||||
<p>A machine-readable [schema] describes what resources are available via the API, what their URLs are, how they are represented and what operations they support.</p>
|
||||
<p>— Heroku, <a href="https://blog.heroku.com/archives/2014/1/8/json_schema_for_heroku_platform_api">JSON Schema for the Heroku Platform API</a></p>
|
||||
|
|
BIN
img/premium/cryptapi-readme.png
Normal file
BIN
img/premium/cryptapi-readme.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
img/premium/posthog-readme.png
Normal file
BIN
img/premium/posthog-readme.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
|
@ -544,10 +544,12 @@ continued development by <strong><a href="community/funding/">signing up for a p
|
|||
<li><a href="https://rollbar.com" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rollbar2.png)">Rollbar</a></li>
|
||||
<li><a href="https://retool.com/?utm_source=djangorest&utm_medium=sponsorship" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/retool-sidebar.png)">Retool</a></li>
|
||||
<li><a href="https://bit.io/jobs?utm_source=DRF&utm_medium=sponsor&utm_campaign=DRF_sponsorship" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/bitio_logo_gold_background.png)">bit.io</a></li>
|
||||
<li><a href="https://posthog.com?utm_source=DRF&utm_medium=sponsor&utm_campaign=DRF_sponsorship" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/135996800-d49fe024-32d9-441a-98d9-4c7596287a67.png)">PostHog</a></li>
|
||||
<li><a href="https://cryptapi.io" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/cryptapi.png)">CryptAPI</a></li>
|
||||
</ul>
|
||||
<div style="clear: both; padding-bottom: 20px;"></div>
|
||||
|
||||
<p><em>Many thanks to all our <a href="https://fund.django-rest-framework.org/topics/funding/#our-sponsors">wonderful sponsors</a>, and in particular to our premium backers, <a href="https://getsentry.com/welcome/">Sentry</a>, <a href="https://getstream.io/?utm_source=drf&utm_medium=sponsorship&utm_content=developer">Stream</a>, <a href="https://software.esg-usa.com/">ESG</a>, <a href="https://rollbar.com/?utm_source=django&utm_medium=sponsorship&utm_campaign=freetrial">Rollbar</a>, <a href="https://cadre.com">Cadre</a>, <a href="https://hubs.ly/H0f30Lf0">Kloudless</a>, <a href="https://lightsonsoftware.com">Lights On Software</a>, <a href="https://retool.com/?utm_source=djangorest&utm_medium=sponsorship">Retool</a>, and <a href="https://bit.io/jobs?utm_source=DRF&utm_medium=sponsor&utm_campaign=DRF_sponsorship">bit.io</a>.</em></p>
|
||||
<p><em>Many thanks to all our <a href="https://fund.django-rest-framework.org/topics/funding/#our-sponsors">wonderful sponsors</a>, and in particular to our premium backers, <a href="https://getsentry.com/welcome/">Sentry</a>, <a href="https://getstream.io/?utm_source=drf&utm_medium=sponsorship&utm_content=developer">Stream</a>, <a href="https://software.esg-usa.com/">ESG</a>, <a href="https://rollbar.com/?utm_source=django&utm_medium=sponsorship&utm_campaign=freetrial">Rollbar</a>, <a href="https://cadre.com">Cadre</a>, <a href="https://hubs.ly/H0f30Lf0">Kloudless</a>, <a href="https://lightsonsoftware.com">Lights On Software</a>, <a href="https://retool.com/?utm_source=djangorest&utm_medium=sponsorship">Retool</a>, <a href="https://bit.io/jobs?utm_source=DRF&utm_medium=sponsor&utm_campaign=DRF_sponsorship">bit.io</a>, <a href="https://posthog.com?utm_source=DRF&utm_medium=sponsor&utm_campaign=DRF_sponsorship">PostHog</a>, and <a href="https://cryptapi.io">CryptAPI</a>.</em></p>
|
||||
<hr />
|
||||
<h2 id="requirements"><a class="toclink" href="#requirements">Requirements</a></h2>
|
||||
<p>REST framework requires the following:</p>
|
||||
|
|
|
@ -43,7 +43,7 @@ function displayResults (results) {
|
|||
|
||||
function doSearch () {
|
||||
var query = document.getElementById('mkdocs-search-query').value;
|
||||
if (query.length > 2) {
|
||||
if (query.length > min_search_length) {
|
||||
if (!window.Worker) {
|
||||
displayResults(search(query));
|
||||
} else {
|
||||
|
@ -73,6 +73,8 @@ function onWorkerMessage (e) {
|
|||
} else if (e.data.results) {
|
||||
var results = e.data.results;
|
||||
displayResults(results);
|
||||
} else if (e.data.config) {
|
||||
min_search_length = e.data.config.min_search_length-1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -58,6 +58,7 @@ function onScriptsLoaded () {
|
|||
if (data.config && data.config.separator && data.config.separator.length) {
|
||||
lunr.tokenizer.separator = new RegExp(data.config.separator);
|
||||
}
|
||||
|
||||
if (data.index) {
|
||||
index = lunr.Index.load(data.index);
|
||||
data.docs.forEach(function (doc) {
|
||||
|
@ -84,6 +85,7 @@ function onScriptsLoaded () {
|
|||
console.log('Lunr index built, search ready');
|
||||
}
|
||||
allowSearch = true;
|
||||
postMessage({config: data.config});
|
||||
postMessage({allowSearch: allowSearch});
|
||||
}
|
||||
|
||||
|
|
132
sitemap.xml
132
sitemap.xml
|
@ -1,267 +1,267 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url>
|
||||
<loc>https://www.django-rest-framework.org/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/quickstart/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/1-serialization/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/2-requests-and-responses/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/3-class-based-views/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/4-authentication-and-permissions/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/5-relationships-and-hyperlinked-apis/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/requests/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/responses/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/views/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/generic-views/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/viewsets/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/routers/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/parsers/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/renderers/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/serializers/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/fields/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/relations/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/validators/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/authentication/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/permissions/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/caching/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/throttling/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/filtering/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/pagination/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/versioning/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/content-negotiation/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/metadata/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/schemas/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/format-suffixes/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/reverse/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/exceptions/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/status-codes/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/testing/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/settings/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/topics/documenting-your-api/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/topics/api-clients/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/topics/internationalization/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/topics/ajax-csrf-cors/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/topics/html-and-forms/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/topics/browser-enhancements/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/topics/browsable-api/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/topics/rest-hypermedia-hateoas/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/tutorials-and-resources/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/third-party-packages/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/contributing/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/project-management/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/release-notes/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.12-announcement/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.11-announcement/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.10-announcement/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.9-announcement/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.8-announcement/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.7-announcement/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.6-announcement/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.5-announcement/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.4-announcement/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.3-announcement/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.2-announcement/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.1-announcement/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.0-announcement/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/kickstarter-announcement/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/mozilla-grant/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/funding/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/jobs/</loc>
|
||||
<lastmod>2021-09-10</lastmod>
|
||||
<lastmod>2021-12-08</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
</urlset>
|
BIN
sitemap.xml.gz
BIN
sitemap.xml.gz
Binary file not shown.
|
@ -457,7 +457,7 @@
|
|||
<h2 id="cors"><a class="toclink" href="#cors">CORS</a></h2>
|
||||
<p><a href="https://www.w3.org/TR/cors/">Cross-Origin Resource Sharing</a> is a mechanism for allowing clients to interact with APIs that are hosted on a different domain. CORS works by requiring the server to include a specific set of headers that allow a browser to determine if and when cross-domain requests should be allowed.</p>
|
||||
<p>The best way to deal with CORS in REST framework is to add the required response headers in middleware. This ensures that CORS is supported transparently, without having to change any behavior in your views.</p>
|
||||
<p><a href="https://github.com/ottoyiu/">Otto Yiu</a> maintains the <a href="https://github.com/ottoyiu/django-cors-headers/">django-cors-headers</a> package, which is known to work correctly with REST framework APIs.</p>
|
||||
<p><a href="https://github.com/adamchainz">Adam Johnson</a> maintains the <a href="https://github.com/adamchainz/django-cors-headers">django-cors-headers</a> package, which is known to work correctly with REST framework APIs.</p>
|
||||
|
||||
|
||||
</div> <!--/span-->
|
||||
|
|
|
@ -493,7 +493,7 @@ from pygments import highlight
|
|||
formatter = HtmlFormatter(style=self.style, linenos=linenos,
|
||||
full=True, **options)
|
||||
self.highlighted = highlight(self.code, lexer, formatter)
|
||||
super(Snippet, self).save(*args, **kwargs)
|
||||
super().save(*args, **kwargs)
|
||||
</code></pre>
|
||||
<p>When that's all done we'll need to update our database tables.
|
||||
Normally we'd create a database migration in order to do that, but for the purposes of this tutorial, let's just delete the database and start again.</p>
|
||||
|
|
|
@ -610,7 +610,7 @@ urlpatterns = [
|
|||
]
|
||||
}
|
||||
</code></pre>
|
||||
<p>Or using the <a href="https://github.com/jakubroztocil/httpie#installation">httpie</a>, command line tool...</p>
|
||||
<p>Or using the <a href="https://httpie.io/docs#installation">httpie</a>, command line tool...</p>
|
||||
<pre><code>bash: http -a admin:password123 http://127.0.0.1:8000/users/
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
|
|
Loading…
Reference in New Issue
Block a user