mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-19 21:11:04 +03:00
Deployed 453196e9
with MkDocs version: 0.16.3
This commit is contained in:
parent
2f043658c8
commit
9381ce1ee2
|
@ -571,7 +571,7 @@ def example_view(request, format=None):
|
|||
<p><strong>.media_type</strong>: <code>*/*</code></p>
|
||||
<h5 id="notes"><a class="toclink" href="#notes">Notes:</a></h5>
|
||||
<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> parser instead.</li>
|
||||
<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>
|
||||
|
|
|
@ -591,7 +591,7 @@ def example_view(request, format=None):
|
|||
</code></pre>
|
||||
<p><strong>Note:</strong> when you set new permission classes through class attribute or decorators you're telling the view to ignore the default list set over the <strong>settings.py</strong> file.</p>
|
||||
<p>Provided they inherit from <code>rest_framework.permissions.BasePermission</code>, permissions can be composed using standard Python bitwise operators. For example, <code>IsAuthenticatedOrReadOnly</code> could be written:</p>
|
||||
<pre><code>from rest_framework.permissions import BasePermission, IsAuthenticated
|
||||
<pre><code>from rest_framework.permissions import BasePermission, IsAuthenticated, SAFE_METHODS
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
|
||||
|
@ -714,7 +714,7 @@ class BlacklistPermission(permissions.BasePermission):
|
|||
<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>
|
||||
<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>
|
||||
<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"><a class="toclink" href="#dry-rest-permissions">DRY Rest Permissions</a></h2>
|
||||
<p>The <a href="https://github.com/Helioscene/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"><a class="toclink" href="#django-rest-framework-roles">Django Rest Framework Roles</a></h2>
|
||||
|
|
|
@ -536,9 +536,8 @@
|
|||
|
||||
<h1 id="serializer-relations"><a class="toclink" href="#serializer-relations">Serializer relations</a></h1>
|
||||
<blockquote>
|
||||
<p>Bad programmers worry about the code.
|
||||
Good programmers worry about data structures and their relationships.</p>
|
||||
<p>— <a href="https://lwn.net/Articles/193245/">Linus Torvalds</a></p>
|
||||
<p>Data structures, not algorithms, are central to programming.</p>
|
||||
<p>— <a href="http://users.ece.utexas.edu/~adnan/pike.html">Rob Pike</a></p>
|
||||
</blockquote>
|
||||
<p>Relational fields are used to represent model relationships. They can be applied to <code>ForeignKey</code>, <code>ManyToManyField</code> and <code>OneToOneField</code> relationships, as well as to reverse relationships, and custom relationships such as <code>GenericForeignKey</code>.</p>
|
||||
<hr />
|
||||
|
@ -549,7 +548,7 @@ Good programmers worry about data structures and their relationships.</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>
|
||||
<pre><code>>>> from myapp.serializers import AccountSerializer
|
||||
>>> serializer = AccountSerializer()
|
||||
>>> print repr(serializer) # Or `print(repr(serializer))` in Python 3.x.
|
||||
>>> print(repr(serializer))
|
||||
AccountSerializer():
|
||||
id = IntegerField(label='ID', read_only=True)
|
||||
name = CharField(allow_blank=True, max_length=100, required=False)
|
||||
|
|
|
@ -633,7 +633,7 @@ def user_count_view(request, format=None):
|
|||
</code></pre>
|
||||
<p>The default JSON encoding style can be altered using the <code>UNICODE_JSON</code> and <code>COMPACT_JSON</code> settings keys.</p>
|
||||
<p><strong>.media_type</strong>: <code>application/json</code></p>
|
||||
<p><strong>.format</strong>: <code>'.json'</code></p>
|
||||
<p><strong>.format</strong>: <code>'json'</code></p>
|
||||
<p><strong>.charset</strong>: <code>None</code></p>
|
||||
<h2 id="templatehtmlrenderer"><a class="toclink" href="#templatehtmlrenderer">TemplateHTMLRenderer</a></h2>
|
||||
<p>Renders data to HTML, using Django's standard template rendering.
|
||||
|
@ -661,7 +661,7 @@ Unlike other renderers, the data passed to the <code>Response</code> does not ne
|
|||
<p>If you're building websites that use <code>TemplateHTMLRenderer</code> along with other renderer classes, you should consider listing <code>TemplateHTMLRenderer</code> as the first class in the <code>renderer_classes</code> list, so that it will be prioritised first even for browsers that send poorly formed <code>ACCEPT:</code> headers.</p>
|
||||
<p>See the <a href="../../topics/html-and-forms/"><em>HTML & Forms</em> Topic Page</a> for further examples of <code>TemplateHTMLRenderer</code> usage.</p>
|
||||
<p><strong>.media_type</strong>: <code>text/html</code></p>
|
||||
<p><strong>.format</strong>: <code>'.html'</code></p>
|
||||
<p><strong>.format</strong>: <code>'html'</code></p>
|
||||
<p><strong>.charset</strong>: <code>utf-8</code></p>
|
||||
<p>See also: <code>StaticHTMLRenderer</code></p>
|
||||
<h2 id="statichtmlrenderer"><a class="toclink" href="#statichtmlrenderer">StaticHTMLRenderer</a></h2>
|
||||
|
@ -675,7 +675,7 @@ def simple_html_view(request):
|
|||
</code></pre>
|
||||
<p>You can use <code>StaticHTMLRenderer</code> either to return regular HTML pages using REST framework, or to return both HTML and API responses from a single endpoint.</p>
|
||||
<p><strong>.media_type</strong>: <code>text/html</code></p>
|
||||
<p><strong>.format</strong>: <code>'.html'</code></p>
|
||||
<p><strong>.format</strong>: <code>'html'</code></p>
|
||||
<p><strong>.charset</strong>: <code>utf-8</code></p>
|
||||
<p>See also: <code>TemplateHTMLRenderer</code></p>
|
||||
<h2 id="browsableapirenderer"><a class="toclink" href="#browsableapirenderer">BrowsableAPIRenderer</a></h2>
|
||||
|
@ -683,7 +683,7 @@ def simple_html_view(request):
|
|||
<p><img alt="The BrowsableAPIRenderer" src="../../img/quickstart.png" /></p>
|
||||
<p>This renderer will determine which other renderer would have been given highest priority, and use that to display an API style response within the HTML page.</p>
|
||||
<p><strong>.media_type</strong>: <code>text/html</code></p>
|
||||
<p><strong>.format</strong>: <code>'.api'</code></p>
|
||||
<p><strong>.format</strong>: <code>'api'</code></p>
|
||||
<p><strong>.charset</strong>: <code>utf-8</code></p>
|
||||
<p><strong>.template</strong>: <code>'rest_framework/api.html'</code></p>
|
||||
<h4 id="customizing-browsableapirenderer"><a class="toclink" href="#customizing-browsableapirenderer">Customizing BrowsableAPIRenderer</a></h4>
|
||||
|
@ -705,7 +705,7 @@ def simple_html_view(request):
|
|||
model = Account
|
||||
</code></pre>
|
||||
<p><strong>.media_type</strong>: <code>text/html</code></p>
|
||||
<p><strong>.format</strong>: <code>'.admin'</code></p>
|
||||
<p><strong>.format</strong>: <code>'admin'</code></p>
|
||||
<p><strong>.charset</strong>: <code>utf-8</code></p>
|
||||
<p><strong>.template</strong>: <code>'rest_framework/admin.html'</code></p>
|
||||
<h2 id="htmlformrenderer"><a class="toclink" href="#htmlformrenderer">HTMLFormRenderer</a></h2>
|
||||
|
@ -721,13 +721,13 @@ def simple_html_view(request):
|
|||
</code></pre>
|
||||
<p>For more information see the <a href="../../topics/html-and-forms/">HTML & Forms</a> documentation.</p>
|
||||
<p><strong>.media_type</strong>: <code>text/html</code></p>
|
||||
<p><strong>.format</strong>: <code>'.form'</code></p>
|
||||
<p><strong>.format</strong>: <code>'form'</code></p>
|
||||
<p><strong>.charset</strong>: <code>utf-8</code></p>
|
||||
<p><strong>.template</strong>: <code>'rest_framework/horizontal/form.html'</code></p>
|
||||
<h2 id="multipartrenderer"><a class="toclink" href="#multipartrenderer">MultiPartRenderer</a></h2>
|
||||
<p>This renderer is used for rendering HTML multipart form data. <strong>It is not suitable as a response renderer</strong>, but is instead used for creating test requests, using REST framework's <a href="../testing/">test client and test request factory</a>.</p>
|
||||
<p><strong>.media_type</strong>: <code>multipart/form-data; boundary=BoUnDaRyStRiNg</code></p>
|
||||
<p><strong>.format</strong>: <code>'.multipart'</code></p>
|
||||
<p><strong>.format</strong>: <code>'multipart'</code></p>
|
||||
<p><strong>.charset</strong>: <code>utf-8</code></p>
|
||||
<hr />
|
||||
<h1 id="custom-renderers"><a class="toclink" href="#custom-renderers">Custom renderers</a></h1>
|
||||
|
|
|
@ -503,10 +503,6 @@
|
|||
<a href="#drf-yasg-yet-another-swagger-generator">drf-yasg - Yet Another Swagger Generator</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#drf-openapi">DRF OpenAPI</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<div class="promo">
|
||||
|
@ -619,8 +615,8 @@ has to be rendered into the actual bytes that are used in the response.</p>
|
|||
<p>REST framework includes a few different renderers that you can use for
|
||||
encoding the API schema.</p>
|
||||
<ul>
|
||||
<li><code>renderers.OpenAPIRenderer</code> - Renders into YAML-based [OpenAPI][openapi], the most widely used API schema format.</li>
|
||||
<li><code>renderers.JSONOpenAPIRenderer</code> - Renders into JSON-based [OpenAPI][openapi].</li>
|
||||
<li><code>renderers.OpenAPIRenderer</code> - Renders into YAML-based <a href="https://openapis.org/">OpenAPI</a>, the most widely used API schema format.</li>
|
||||
<li><code>renderers.JSONOpenAPIRenderer</code> - Renders into JSON-based <a href="https://openapis.org/">OpenAPI</a>.</li>
|
||||
<li><code>renderers.CoreJSONRenderer</code> - Renders into <a href="https://www.coreapi.org/specification/encoding/#core-json-encoding">Core JSON</a>, a format designed for
|
||||
use with the <code>coreapi</code> client library.</li>
|
||||
</ul>
|
||||
|
@ -1158,9 +1154,6 @@ Valid only if a <code>location="body"</code> field is included on the <code>Link
|
|||
<h2 id="drf-yasg-yet-another-swagger-generator"><a class="toclink" href="#drf-yasg-yet-another-swagger-generator">drf-yasg - Yet Another Swagger Generator</a></h2>
|
||||
<p><a href="https://github.com/axnsan12/drf-yasg/">drf-yasg</a> generates <a href="https://openapis.org/">OpenAPI</a> documents suitable for code generation - nested schemas,
|
||||
named models, response bodies, enum/pattern/min/max validators, form parameters, etc.</p>
|
||||
<h2 id="drf-openapi"><a class="toclink" href="#drf-openapi">DRF OpenAPI</a></h2>
|
||||
<p><a href="https://github.com/limdauto/drf_openapi">DRF OpenAPI</a> renders the schema generated by Django Rest Framework
|
||||
in <a href="https://openapis.org/">OpenAPI</a> format.</p>
|
||||
|
||||
|
||||
</div> <!--/span-->
|
||||
|
|
|
@ -694,7 +694,7 @@ response = client.get('http://testserver/users/')
|
|||
assert response.status_code == 200
|
||||
</code></pre>
|
||||
<p>Note that the requests client requires you to pass fully qualified URLs.</p>
|
||||
<h2 id="requestsclient-and-working-with-the-database"><a class="toclink" href="#requestsclient-and-working-with-the-database"><code>RequestsClient</code> and working with the database</a></h2>
|
||||
<h2 id="requestsclient-and-working-with-the-database"><a class="toclink" href="#requestsclient-and-working-with-the-database">RequestsClient and working with the database</a></h2>
|
||||
<p>The <code>RequestsClient</code> class is useful if you want to write tests that solely interact with the service interface. This is a little stricter than using the standard Django test client, as it means that all interactions should be via the API.</p>
|
||||
<p>If you're using <code>RequestsClient</code> you'll want to ensure that test setup, and results assertions are performed as regular API calls, rather than interacting with the database models directly. For example, rather than checking that <code>Customer.objects.count() == 3</code> you would list the customers endpoint, and ensure that it contains three records.</p>
|
||||
<h2 id="headers-authentication"><a class="toclink" href="#headers-authentication">Headers & Authentication</a></h2>
|
||||
|
|
|
@ -465,7 +465,7 @@
|
|||
<p><strong>This release is incremental in nature. There <em>are</em> some breaking API changes, and upgrading <em>will</em> require you to read the release notes carefully, but the migration path should otherwise be relatively straightforward.</strong></p>
|
||||
<p>The difference in quality of the REST framework API and implementation should make writing, maintaining and debugging your application far easier.</p>
|
||||
<p>3.0 is the first of three releases that have been funded by our recent <a href="https://www.kickstarter.com/projects/tomchristie/django-rest-framework-3">Kickstarter campaign</a>.</p>
|
||||
<p>As ever, a huge thank you to our many <a href="https://www.django-rest-framework.org/topics/kickstarter-announcement/#sponsors">wonderful sponsors</a>. If you're looking for a Django gig, and want to work with smart community-minded folks, you should probably check out that list and see who's hiring.</p>
|
||||
<p>As ever, a huge thank you to our many <a href="https://www.django-rest-framework.org/community/kickstarter-announcement/#sponsors">wonderful sponsors</a>. If you're looking for a Django gig, and want to work with smart community-minded folks, you should probably check out that list and see who's hiring.</p>
|
||||
<hr />
|
||||
<h2 id="new-features"><a class="toclink" href="#new-features">New features</a></h2>
|
||||
<p>Notable features of this new release include:</p>
|
||||
|
|
|
@ -476,7 +476,7 @@
|
|||
</ul>
|
||||
<h4 id="new-pagination-schemes"><a class="toclink" href="#new-pagination-schemes">New pagination schemes.</a></h4>
|
||||
<p>Until now, there has only been a single built-in pagination style in REST framework. We now have page, limit/offset and cursor based schemes included by default.</p>
|
||||
<p>The cursor based pagination scheme is particularly smart, and is a better approach for clients iterating through large or frequently changing result sets. The scheme supports paging against non-unique indexes, by using both cursor and limit/offset information. It also allows for both forward and reverse cursor pagination. Much credit goes to David Cramer for <a href="http://cramer.io/2011/03/08/building-cursors-for-the-disqus-api">this blog post</a> on the subject.</p>
|
||||
<p>The cursor based pagination scheme is particularly smart, and is a better approach for clients iterating through large or frequently changing result sets. The scheme supports paging against non-unique indexes, by using both cursor and limit/offset information. It also allows for both forward and reverse cursor pagination. Much credit goes to David Cramer for <a href="https://cra.mr/2011/03/08/building-cursors-for-the-disqus-api">this blog post</a> on the subject.</p>
|
||||
<h4 id="pagination-controls-in-the-browsable-api"><a class="toclink" href="#pagination-controls-in-the-browsable-api">Pagination controls in the browsable API.</a></h4>
|
||||
<p>Paginated results now include controls that render directly in the browsable API. If you're using the page or limit/offset style, then you'll see a page based control displayed in the browsable API:</p>
|
||||
<p><img alt="page number based pagination" src="../../img/pages-pagination.png" /></p>
|
||||
|
@ -535,7 +535,7 @@ Host: example.org
|
|||
</code></pre>
|
||||
<p>Note that the structure of the error responses is still the same. We still have a <code>detail</code> key in the response. If needed you can modify this behavior too, by using a <a href="../../api-guide/exceptions/#custom-exception-handling">custom exception handler</a>.</p>
|
||||
<p>We include built-in translations both for standard exception cases, and for serializer validation errors.</p>
|
||||
<p>The full list of supported languages can be found on our <a href="https://www.transifex.com/projects/p/django-rest-framework/">Transifex project page</a>.</p>
|
||||
<p>The full list of supported languages can be found on our <a href="https://www.transifex.com/django-rest-framework-1/django-rest-framework/">Transifex project page</a>.</p>
|
||||
<p>If you only wish to support a subset of the supported languages, use Django's standard <code>LANGUAGES</code> setting:</p>
|
||||
<pre><code>LANGUAGES = [
|
||||
('de', _('German')),
|
||||
|
@ -559,13 +559,13 @@ Host: example.org
|
|||
<h2 id="moving-packages-out-of-core"><a class="toclink" href="#moving-packages-out-of-core">Moving packages out of core</a></h2>
|
||||
<p>We've now moved a number of packages out of the core of REST framework, and into separately installable packages. If you're currently using these you don't need to worry, you simply need to <code>pip install</code> the new packages, and change any import paths.</p>
|
||||
<p>We're making this change in order to help distribute the maintenance workload, and keep better focus of the core essentials of the framework.</p>
|
||||
<p>The change also means we can be more flexible with which external packages we recommend. For example, the excellently maintained <a href="https://github.com/evonove/django-oauth-toolkit">Django OAuth toolkit</a> has now been promoted as our recommended option for integrating OAuth support.</p>
|
||||
<p>The change also means we can be more flexible with which external packages we recommend. For example, the excellently maintained <a href="https://github.com/jazzband/django-oauth-toolkit">Django OAuth toolkit</a> has now been promoted as our recommended option for integrating OAuth support.</p>
|
||||
<p>The following packages are now moved out of core and should be separately installed:</p>
|
||||
<ul>
|
||||
<li>OAuth - <a href="https://jpadilla.github.io/django-rest-framework-oauth/">djangorestframework-oauth</a></li>
|
||||
<li>XML - <a href="https://jpadilla.github.io/django-rest-framework-xml">djangorestframework-xml</a></li>
|
||||
<li>YAML - <a href="https://jpadilla.github.io/django-rest-framework-yaml">djangorestframework-yaml</a></li>
|
||||
<li>JSONP - <a href="https://jpadilla.github.io/django-rest-framework-jsonp">djangorestframework-jsonp</a></li>
|
||||
<li>XML - <a href="https://jpadilla.github.io/django-rest-framework-xml/">djangorestframework-xml</a></li>
|
||||
<li>YAML - <a href="https://jpadilla.github.io/django-rest-framework-yaml/">djangorestframework-yaml</a></li>
|
||||
<li>JSONP - <a href="https://jpadilla.github.io/django-rest-framework-jsonp/">djangorestframework-jsonp</a></li>
|
||||
</ul>
|
||||
<p>It's worth reiterating that this change in policy shouldn't mean any work in your codebase other than adding a new requirement and modifying some import paths. For example to install XML rendering, you would now do:</p>
|
||||
<pre><code>pip install djangorestframework-xml
|
||||
|
|
|
@ -446,7 +446,7 @@
|
|||
<p>This interface is intended to act as a more user-friendly interface to the API. It can be used either as a replacement to the existing <code>BrowsableAPIRenderer</code>, or used together with it, allowing you to switch between the two styles as required.</p>
|
||||
<p>We've also fixed a huge number of issues, and made numerous cleanups and improvements.</p>
|
||||
<p>Over the course of the 3.1.x series we've <a href="https://github.com/encode/django-rest-framework/issues?utf8=%E2%9C%93&q=closed%3A%3E2015-03-05">resolved nearly 600 tickets</a> on our GitHub issue tracker. This means we're currently running at a rate of <strong>closing around 100 issues or pull requests per month</strong>.</p>
|
||||
<p>None of this would have been possible without the support of our wonderful Kickstarter backers. If you're looking for a job in Django development we'd strongly recommend taking <a href="https://www.django-rest-framework.org/topics/kickstarter-announcement/#sponsors">a look through our sponsors</a> and finding out who's hiring.</p>
|
||||
<p>None of this would have been possible without the support of our wonderful Kickstarter backers. If you're looking for a job in Django development we'd strongly recommend taking <a href="https://www.django-rest-framework.org/community/kickstarter-announcement/#sponsors">a look through our sponsors</a> and finding out who's hiring.</p>
|
||||
<h2 id="adminrenderer"><a class="toclink" href="#adminrenderer">AdminRenderer</a></h2>
|
||||
<p>To include <code>AdminRenderer</code> simply add it to your settings:</p>
|
||||
<pre><code>REST_FRAMEWORK = {
|
||||
|
|
|
@ -472,14 +472,14 @@ continued development by <strong><a href="../funding/">signing up for a paid pla
|
|||
Right now we're over 60% of the way towards achieving that.
|
||||
<em>Every single sign-up makes a significant impact.</em></p>
|
||||
<ul class="premium-promo promo">
|
||||
<li><a href="http://jobs.rover.com/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)">Rover.com</a></li>
|
||||
<li><a href="https://getsentry.com/welcome/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)">Sentry</a></li>
|
||||
<li><a href="https://www.rover.com/careers/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)">Rover.com</a></li>
|
||||
<li><a href="https://sentry.io/welcome/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)">Sentry</a></li>
|
||||
<li><a href="https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/stream-130.png)">Stream</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">awesome sponsors</a>, and in particular to our premium backers, <a href="http://jobs.rover.com/">Rover</a>, <a href="https://getsentry.com/welcome/">Sentry</a>, and <a href="https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf">Stream</a>.</em></p>
|
||||
<p><em>Many thanks to all our <a href="https://fund.django-rest-framework.org/topics/funding/#our-sponsors">awesome sponsors</a>, and in particular to our premium backers, <a href="https://www.rover.com/careers/">Rover</a>, <a href="https://sentry.io/welcome/">Sentry</a>, and <a href="https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf">Stream</a>.</em></p>
|
||||
<hr />
|
||||
<h2 id="schemas-client-libraries"><a class="toclink" href="#schemas-client-libraries">Schemas & client libraries</a></h2>
|
||||
<p>REST framework 3.4 brings built-in support for generating API schemas.</p>
|
||||
|
|
|
@ -485,15 +485,15 @@ If you use REST framework commercially and would like to see this work continue,
|
|||
we strongly encourage you to invest in its continued development by
|
||||
<strong><a href="../funding/">signing up for a paid plan</a></strong>.</p>
|
||||
<ul class="premium-promo promo">
|
||||
<li><a href="http://jobs.rover.com/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)">Rover.com</a></li>
|
||||
<li><a href="https://getsentry.com/welcome/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)">Sentry</a></li>
|
||||
<li><a href="https://www.rover.com/careers/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)">Rover.com</a></li>
|
||||
<li><a href="https://sentry.io/welcome/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)">Sentry</a></li>
|
||||
<li><a href="https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/stream-130.png)">Stream</a></li>
|
||||
<li><a href="https://www.machinalis.com/#services" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/Machinalis130.png)">Machinalis</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">sponsors</a>, and in particular to our premium backers, <a href="http://jobs.rover.com/">Rover</a>, <a href="https://getsentry.com/welcome/">Sentry</a>, <a href="https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf">Stream</a>, and <a href="https://www.machinalis.com/#services">Machinalis</a>.</em></p>
|
||||
<p><em>Many thanks to all our <a href="https://fund.django-rest-framework.org/topics/funding/#our-sponsors">sponsors</a>, and in particular to our premium backers, <a href="https://www.rover.com/careers/">Rover</a>, <a href="https://sentry.io/welcome/">Sentry</a>, <a href="https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf">Stream</a>, and <a href="https://www.machinalis.com/#services">Machinalis</a>.</em></p>
|
||||
<hr />
|
||||
<h2 id="improved-schema-generation"><a class="toclink" href="#improved-schema-generation">Improved schema generation</a></h2>
|
||||
<p>Docstrings on views are now pulled through into schema definitions, allowing
|
||||
|
|
|
@ -478,17 +478,17 @@
|
|||
we strongly encourage you to invest in its continued development by
|
||||
<strong><a href="../funding/">signing up for a paid plan</a></strong>.</p>
|
||||
<ul class="premium-promo promo">
|
||||
<li><a href="http://jobs.rover.com/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)">Rover.com</a></li>
|
||||
<li><a href="https://getsentry.com/welcome/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)">Sentry</a></li>
|
||||
<li><a href="https://www.rover.com/careers/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)">Rover.com</a></li>
|
||||
<li><a href="https://sentry.io/welcome/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)">Sentry</a></li>
|
||||
<li><a href="https://getstream.io/try-the-api/?utm_source=drf&utm_medium=banner&utm_campaign=drf" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/stream-130.png)">Stream</a></li>
|
||||
<li><a href="https://hello.machinalis.co.uk/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/Machinalis130.png)">Machinalis</a></li>
|
||||
<li><a href="https://machinalis.com/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/Machinalis130.png)">Machinalis</a></li>
|
||||
<li><a href="https://rollbar.com" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rollbar.png)">Rollbar</a></li>
|
||||
<li><a href="https://micropyramid.com/django-rest-framework-development-services/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/mp-text-logo.png)">MicroPyramid</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">sponsors</a>, and in particular to our premium backers, <a href="http://jobs.rover.com/">Rover</a>, <a href="https://getsentry.com/welcome/">Sentry</a>, <a href="https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf">Stream</a>, <a href="https://hello.machinalis.co.uk/">Machinalis</a>, <a href="https://rollbar.com">Rollbar</a>, and <a href="https://micropyramid.com/django-rest-framework-development-services/">MicroPyramid</a>.</em></p>
|
||||
<p><em>Many thanks to all our <a href="https://fund.django-rest-framework.org/topics/funding/#our-sponsors">sponsors</a>, and in particular to our premium backers, <a href="https://www.rover.com/careers/">Rover</a>, <a href="https://sentry.io/welcome/">Sentry</a>, <a href="https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf">Stream</a>, <a href="https://machinalis.com/">Machinalis</a>, <a href="https://rollbar.com">Rollbar</a>, and <a href="https://micropyramid.com/django-rest-framework-development-services/">MicroPyramid</a>.</em></p>
|
||||
<hr />
|
||||
<h2 id="interactive-api-documentation"><a class="toclink" href="#interactive-api-documentation">Interactive API documentation</a></h2>
|
||||
<p>REST framework's new API documentation supports a number of features:</p>
|
||||
|
|
|
@ -472,16 +472,16 @@
|
|||
<p>If you use REST framework commercially and would like to see this work continue, we strongly encourage you to invest in its continued development by
|
||||
<strong><a href="../funding/">signing up for a paid plan</a></strong>.</p>
|
||||
<ul class="premium-promo promo">
|
||||
<li><a href="http://jobs.rover.com/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)">Rover.com</a></li>
|
||||
<li><a href="https://getsentry.com/welcome/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)">Sentry</a></li>
|
||||
<li><a href="https://www.rover.com/careers/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)">Rover.com</a></li>
|
||||
<li><a href="https://sentry.io/welcome/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)">Sentry</a></li>
|
||||
<li><a href="https://getstream.io/try-the-api/?utm_source=drf&utm_medium=banner&utm_campaign=drf" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/stream-130.png)">Stream</a></li>
|
||||
<li><a href="https://hello.machinalis.co.uk/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/Machinalis130.png)">Machinalis</a></li>
|
||||
<li><a href="https://machinalis.com/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/Machinalis130.png)">Machinalis</a></li>
|
||||
<li><a href="https://rollbar.com" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rollbar.png)">Rollbar</a></li>
|
||||
</ul>
|
||||
|
||||
<div style="clear: both; padding-bottom: 20px;"></div>
|
||||
|
||||
<p><em>As well as our release sponsor, we'd like to say thanks in particular our premium backers, <a href="http://jobs.rover.com/">Rover</a>, <a href="https://getsentry.com/welcome/">Sentry</a>, <a href="https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf">Stream</a>, <a href="https://hello.machinalis.co.uk/">Machinalis</a>, and <a href="https://rollbar.com">Rollbar</a>.</em></p>
|
||||
<p><em>As well as our release sponsor, we'd like to say thanks in particular our premium backers, <a href="https://www.rover.com/careers/">Rover</a>, <a href="https://sentry.io/welcome/">Sentry</a>, <a href="https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf">Stream</a>, <a href="https://machinalis.com/">Machinalis</a>, and <a href="https://rollbar.com">Rollbar</a>.</em></p>
|
||||
<hr />
|
||||
<h2 id="customizing-api-docs-schema-generation"><a class="toclink" href="#customizing-api-docs-schema-generation">Customizing API docs & schema generation.</a></h2>
|
||||
<p>The schema generation introduced in 3.5 and the related API docs generation in 3.6 are both hugely powerful features, however they've been somewhat limited in cases where the view introspection isn't able to correctly identify the schema for a particular view.</p>
|
||||
|
|
|
@ -466,7 +466,7 @@ the foundations for future changes.</p>
|
|||
<h2 id="funding"><a class="toclink" href="#funding">Funding</a></h2>
|
||||
<p>If you use REST framework commercially and would like to see this work continue, we strongly encourage you to invest in its continued development by
|
||||
<strong><a href="../funding/">signing up for a paid plan</a></strong>.</p>
|
||||
<p><em>We'd like to say thanks in particular our premium backers, <a href="http://jobs.rover.com/">Rover</a>, <a href="https://getsentry.com/welcome/">Sentry</a>, <a href="https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf">Stream</a>, <a href="https://hello.machinalis.co.uk/">Machinalis</a>, and <a href="https://rollbar.com">Rollbar</a>.</em></p>
|
||||
<p><em>We'd like to say thanks in particular our premium backers, <a href="https://www.rover.com/careers/">Rover</a>, <a href="https://sentry.io/welcome/">Sentry</a>, <a href="https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf">Stream</a>, <a href="https://machinalis.com/">Machinalis</a>, and <a href="https://rollbar.com">Rollbar</a>.</em></p>
|
||||
<hr />
|
||||
<h2 id="breaking-changes"><a class="toclink" href="#breaking-changes">Breaking Changes</a></h2>
|
||||
<h3 id="altered-the-behaviour-of-read_only-plus-default-on-field"><a class="toclink" href="#altered-the-behaviour-of-read_only-plus-default-on-field">Altered the behaviour of <code>read_only</code> plus <code>default</code> on Field.</a></h3>
|
||||
|
|
|
@ -478,8 +478,8 @@
|
|||
<p>If you use REST framework commercially and would like to see this work continue, we strongly encourage you to invest in its continued development by
|
||||
<strong><a href="../funding/">signing up for a paid plan</a></strong>.</p>
|
||||
<ul class="premium-promo promo">
|
||||
<li><a href="http://jobs.rover.com/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)">Rover.com</a></li>
|
||||
<li><a href="https://getsentry.com/welcome/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)">Sentry</a></li>
|
||||
<li><a href="https://www.rover.com/careers/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)">Rover.com</a></li>
|
||||
<li><a href="https://sentry.io/welcome/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)">Sentry</a></li>
|
||||
<li><a href="https://getstream.io/try-the-api/?utm_source=drf&utm_medium=banner&utm_campaign=drf" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/stream-130.png)">Stream</a></li>
|
||||
<li><a href="https://auklet.io" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/auklet-new.png)">Auklet</a></li>
|
||||
<li><a href="https://rollbar.com" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rollbar2.png)">Rollbar</a></li>
|
||||
|
@ -490,7 +490,7 @@
|
|||
|
||||
<div style="clear: both; padding-bottom: 20px;"></div>
|
||||
|
||||
<p><em>Many thanks to all our <a href="https://fund.django-rest-framework.org/topics/funding/#our-sponsors">wonderful sponsors</a>, and in particular to our premium backers, <a href="http://jobs.rover.com/">Rover</a>, <a href="https://getsentry.com/welcome/">Sentry</a>, <a href="https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf">Stream</a>, <a href="https://auklet.io/">Auklet</a>, <a href="https://rollbar.com">Rollbar</a>, <a href="https://cadre.com">Cadre</a>, <a href="https://loadimpact.com/?utm_campaign=Sponsorship%20links&utm_source=drf&utm_medium=drf">Load Impact</a>, and <a href="https://hubs.ly/H0f30Lf0">Kloudless</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://www.rover.com/careers/">Rover</a>, <a href="https://sentry.io/welcome/">Sentry</a>, <a href="https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf">Stream</a>, <a href="https://auklet.io/">Auklet</a>, <a href="https://rollbar.com">Rollbar</a>, <a href="https://cadre.com">Cadre</a>, <a href="https://loadimpact.com/?utm_campaign=Sponsorship%20links&utm_source=drf&utm_medium=drf">Load Impact</a>, and <a href="https://hubs.ly/H0f30Lf0">Kloudless</a>.</em></p>
|
||||
<hr />
|
||||
<h2 id="built-in-openapi-schema-support"><a class="toclink" href="#built-in-openapi-schema-support">Built-in OpenAPI schema support</a></h2>
|
||||
<p>REST framework now has a first-pass at directly including OpenAPI schema support. (Formerly known as Swagger)</p>
|
||||
|
|
|
@ -572,10 +572,10 @@ form.signup {
|
|||
<hr />
|
||||
<h2 id="what-funding-has-enabled-so-far"><a class="toclink" href="#what-funding-has-enabled-so-far">What funding has enabled so far</a></h2>
|
||||
<ul>
|
||||
<li>The <a href="https://www.django-rest-framework.org/topics/3.4-announcement/">3.4</a> and <a href="https://www.django-rest-framework.org/topics/3.5-announcement/">3.5</a> releases, including schema generation for both Swagger and RAML, a Python client library, a Command Line client, and addressing of a large number of outstanding issues.</li>
|
||||
<li>The <a href="https://www.django-rest-framework.org/topics/3.6-announcement/">3.6</a> release, including JavaScript client library, and API documentation, complete with auto-generated code samples.</li>
|
||||
<li>The <a href="https://www.django-rest-framework.org/topics/3.7-announcement/">3.7 release</a>, made possible due to our collaborative funding model, focuses on improvements to schema generation and the interactive API documentation.</li>
|
||||
<li>The recent <a href="https://www.django-rest-framework.org/topics/3.8-announcement/">3.8 release</a>.</li>
|
||||
<li>The <a href="https://www.django-rest-framework.org/community/3.4-announcement/">3.4</a> and <a href="https://www.django-rest-framework.org/community/3.5-announcement/">3.5</a> releases, including schema generation for both Swagger and RAML, a Python client library, a Command Line client, and addressing of a large number of outstanding issues.</li>
|
||||
<li>The <a href="https://www.django-rest-framework.org/community/3.6-announcement/">3.6</a> release, including JavaScript client library, and API documentation, complete with auto-generated code samples.</li>
|
||||
<li>The <a href="https://www.django-rest-framework.org/community/3.7-announcement/">3.7 release</a>, made possible due to our collaborative funding model, focuses on improvements to schema generation and the interactive API documentation.</li>
|
||||
<li>The recent <a href="https://www.django-rest-framework.org/community/3.8-announcement/">3.8 release</a>.</li>
|
||||
<li>Tom Christie, the creator of Django REST framework, working on the project full-time.</li>
|
||||
<li>Around 80-90 issues and pull requests closed per month since Tom Christie started working on the project full-time.</li>
|
||||
<li>A community & operations manager position part-time for 4 months, helping mature the business and grow sponsorship.</li>
|
||||
|
@ -770,7 +770,7 @@ DRF is one of the core reasons why Django is top choice among web frameworks tod
|
|||
<p>For further enquires please contact <a href=mailto:funding@django-rest-framework.org>funding@django-rest-framework.org</a>.</p>
|
||||
<hr />
|
||||
<h2 id="accountability"><a class="toclink" href="#accountability">Accountability</a></h2>
|
||||
<p>In an effort to keep the project as transparent as possible, we are releasing <a href="https://www.encode.io/reports/march-2018">monthly progress reports</a> and regularly include financial reports and cost breakdowns.</p>
|
||||
<p>In an effort to keep the project as transparent as possible, we are releasing <a href="https://www.encode.io/reports/march-2018/">monthly progress reports</a> and regularly include financial reports and cost breakdowns.</p>
|
||||
<!-- Begin MailChimp Signup Form -->
|
||||
|
||||
<p><link href="//cdn-images.mailchimp.com/embedcode/classic-10_7.css" rel="stylesheet" type="text/css">
|
||||
|
|
|
@ -432,14 +432,12 @@
|
|||
<li><a href="https://www.python.org/jobs/">https://www.python.org/jobs/</a></li>
|
||||
<li><a href="https://djangogigs.com">https://djangogigs.com</a></li>
|
||||
<li><a href="https://djangojobs.net/jobs/">https://djangojobs.net/jobs/</a></li>
|
||||
<li><a href="http://djangojobbers.com">http://djangojobbers.com</a></li>
|
||||
<li><a href="https://www.indeed.com/q-Django-jobs.html">https://www.indeed.com/q-Django-jobs.html</a></li>
|
||||
<li><a href="https://stackoverflow.com/jobs/developer-jobs-using-django">https://stackoverflow.com/jobs/developer-jobs-using-django</a></li>
|
||||
<li><a href="https://www.upwork.com/o/jobs/browse/skill/django-framework/">https://www.upwork.com/o/jobs/browse/skill/django-framework/</a></li>
|
||||
<li><a href="https://www.technojobs.co.uk/django-jobs">https://www.technojobs.co.uk/django-jobs</a></li>
|
||||
<li><a href="https://remoteok.io/remote-django-jobs">https://remoteok.io/remote-django-jobs</a></li>
|
||||
<li><a href="https://www.remotepython.com/jobs/">https://www.remotepython.com/jobs/</a></li>
|
||||
<li><a href="https://weworkcontract.com/python-contract-jobs">https://weworkcontract.com/python-contract-jobs</a></li>
|
||||
</ul>
|
||||
<p>Know of any other great resources for Django REST Framework jobs that are missing in our list? Please <a href="https://github.com/encode/django-rest-framework">submit a pull request</a> or <a href="mailto:anna@django-rest-framework.org">email us</a>.</p>
|
||||
<p>Wonder how else you can help? One of the best ways you can help Django REST Framework is to ask interviewers if their company is signed up for <a href="https://fund.django-rest-framework.org/topics/funding/">REST Framework sponsorship</a> yet.</p>
|
||||
|
|
|
@ -461,8 +461,8 @@
|
|||
</ul>
|
||||
|
||||
<ul class="sponsor platinum">
|
||||
<li><a href="https://www.divio.ch/" rel="nofollow" style="background-image:url(../../img/sponsors/1-divio.png);">Divio</a></li>
|
||||
<li><a href="http://company.onlulu.com/en/" rel="nofollow" style="background-image:url(../../img/sponsors/1-lulu.png);">Lulu</a></li>
|
||||
<li><a href="https://www.divio.com/" rel="nofollow" style="background-image:url(../../img/sponsors/1-divio.png);">Divio</a></li>
|
||||
<li><a href="https://onlulu.com" rel="nofollow" style="background-image:url(../../img/sponsors/1-lulu.png);">Lulu</a></li>
|
||||
<li><a href="https://p.ota.to/" rel="nofollow" style="background-image:url(../../img/sponsors/1-potato.png);">Potato</a></li>
|
||||
<li><a href="http://www.wiredrive.com/" rel="nofollow" style="background-image:url(../../img/sponsors/1-wiredrive.png);">Wiredrive</a></li>
|
||||
<li><a href="http://www.cyaninc.com/" rel="nofollow" style="background-image:url(../../img/sponsors/1-cyan.png);">Cyan</a></li>
|
||||
|
@ -492,8 +492,8 @@
|
|||
<li><a href="https://www.lightningkite.com/" rel="nofollow" style="background-image:url(../../img/sponsors/2-lightning_kite.png);">Lightning Kite</a></li>
|
||||
<li><a href="https://opbeat.com/" rel="nofollow" style="background-image:url(../../img/sponsors/2-opbeat.png);">Opbeat</a></li>
|
||||
<li><a href="https://koordinates.com" rel="nofollow" style="background-image:url(../../img/sponsors/2-koordinates.png);">Koordinates</a></li>
|
||||
<li><a href="http://pulsecode.ca" rel="nofollow" style="background-image:url(../../img/sponsors/2-pulsecode.png);">Pulsecode Inc.</a></li>
|
||||
<li><a href="http://singinghorsestudio.com" rel="nofollow" style="background-image:url(../../img/sponsors/2-singing-horse.png);">Singing Horse Studio Ltd.</a></li>
|
||||
<li><a rel="nofollow" style="background-image:url(../../img/sponsors/2-pulsecode.png);">Pulsecode Inc.</a></li>
|
||||
<li><a rel="nofollow" style="background-image:url(../../img/sponsors/2-singing-horse.png);">Singing Horse Studio Ltd.</a></li>
|
||||
<li><a href="https://www.heroku.com/" rel="nofollow" style="background-image:url(../../img/sponsors/2-heroku.png);">Heroku</a></li>
|
||||
<li><a href="https://www.rheinwerk-verlag.de/" rel="nofollow" style="background-image:url(../../img/sponsors/2-rheinwerk_verlag.png);">Rheinwerk Verlag</a></li>
|
||||
<li><a href="https://www.securitycompass.com/" rel="nofollow" style="background-image:url(../../img/sponsors/2-security_compass.png);">Security Compass</a></li>
|
||||
|
@ -501,9 +501,9 @@
|
|||
<li><a href="http://www.hipflaskapp.com" rel="nofollow" style="background-image:url(../../img/sponsors/2-hipflask.png);">Hipflask</a></li>
|
||||
<li><a href="http://www.crate.io/" rel="nofollow" style="background-image:url(../../img/sponsors/2-crate.png);">Crate</a></li>
|
||||
<li><a href="http://crypticocorp.com/" rel="nofollow" style="background-image:url(../../img/sponsors/2-cryptico.png);">Cryptico Corp</a></li>
|
||||
<li><a href="http://www.nexthub.com/" rel="nofollow" style="background-image:url(../../img/sponsors/2-nexthub.png);">NextHub</a></li>
|
||||
<li><a rel="nofollow" style="background-image:url(../../img/sponsors/2-nexthub.png);">NextHub</a></li>
|
||||
<li><a href="https://www.compile.com/" rel="nofollow" style="background-image:url(../../img/sponsors/2-compile.png);">Compile</a></li>
|
||||
<li><a href="http://wusawork.org" rel="nofollow" style="background-image:url(../../img/sponsors/2-wusawork.png);">WusaWork</a></li>
|
||||
<li><a rel="nofollow" style="background-image:url(../../img/sponsors/2-wusawork.png);">WusaWork</a></li>
|
||||
<li><a href="http://envisionlinux.org/blog" rel="nofollow">Envision Linux</a></li>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -505,6 +505,13 @@
|
|||
</code></pre>
|
||||
<hr />
|
||||
<h2 id="39x-series"><a class="toclink" href="#39x-series">3.9.x series</a></h2>
|
||||
<h3 id="391"><a class="toclink" href="#391">3.9.1</a></h3>
|
||||
<p><strong>Date</strong>: <a href="https://github.com/encode/django-rest-framework/milestone/70?closed=1">16th Janurary 2019</a></p>
|
||||
<ul>
|
||||
<li>Resolve XSS issue in browsable API. <a href="https://github.com/encode/django-rest-framework/issues/6330">#6330</a></li>
|
||||
<li>Resolve issues with composable permissions. <a href="https://github.com/encode/django-rest-framework/issues/6299">#6299</a></li>
|
||||
<li>Respect <code>limit_choices_to</code> on foreign keys. <a href="https://github.com/encode/django-rest-framework/issues/6371">#6371</a></li>
|
||||
</ul>
|
||||
<h3 id="390"><a class="toclink" href="#390">3.9.0</a></h3>
|
||||
<p><strong>Date</strong>: <a href="https://github.com/encode/django-rest-framework/milestone/66?closed=1">18th October 2018</a></p>
|
||||
<ul>
|
||||
|
@ -1547,6 +1554,8 @@ Previously may have been stored internally as <code>None</code>.</p>
|
|||
<!-- 3.8.2 -->
|
||||
|
||||
<!-- 3.9.0 -->
|
||||
|
||||
<!-- 3.9.1 -->
|
||||
|
||||
|
||||
</div> <!--/span-->
|
||||
|
|
|
@ -555,6 +555,8 @@ continued development by <strong><a href="community/funding/">signing up for a p
|
|||
<li>Python (2.7, 3.4, 3.5, 3.6, 3.7)</li>
|
||||
<li>Django (1.11, 2.0, 2.1)</li>
|
||||
</ul>
|
||||
<p>We <strong>highly recommend</strong> and only officially support the latest patch release of
|
||||
each Python and Django series.</p>
|
||||
<p>The following packages are optional:</p>
|
||||
<ul>
|
||||
<li><a href="https://pypi.org/project/coreapi/">coreapi</a> (1.32.0+) - Schema generation support.</li>
|
||||
|
@ -570,7 +572,7 @@ pip install markdown # Markdown support for the browsable API.
|
|||
pip install django-filter # Filtering support
|
||||
</code></pre>
|
||||
<p>...or clone the project from github.</p>
|
||||
<pre><code>git clone git@github.com:encode/django-rest-framework.git
|
||||
<pre><code>git clone https://github.com/encode/django-rest-framework
|
||||
</code></pre>
|
||||
<p>Add <code>'rest_framework'</code> to your <code>INSTALLED_APPS</code> setting.</p>
|
||||
<pre><code>INSTALLED_APPS = (
|
||||
|
|
File diff suppressed because one or more lines are too long
128
sitemap.xml
128
sitemap.xml
|
@ -4,7 +4,7 @@
|
|||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
|
@ -13,49 +13,49 @@
|
|||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//tutorial/quickstart/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//tutorial/1-serialization/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//tutorial/2-requests-and-responses/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//tutorial/3-class-based-views/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//tutorial/4-authentication-and-permissions/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//tutorial/5-relationships-and-hyperlinked-apis/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//tutorial/6-viewsets-and-routers/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//tutorial/7-schemas-and-client-libraries/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
|
@ -65,169 +65,169 @@
|
|||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/requests/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/responses/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/views/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/generic-views/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/viewsets/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/routers/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/parsers/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/renderers/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/serializers/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/fields/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/relations/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/validators/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/authentication/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/permissions/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/caching/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/throttling/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/filtering/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/pagination/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/versioning/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/content-negotiation/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/metadata/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/schemas/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/format-suffixes/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/reverse/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/exceptions/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/status-codes/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/testing/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//api-guide/settings/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
|
@ -237,49 +237,49 @@
|
|||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//topics/documenting-your-api/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//topics/api-clients/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//topics/internationalization/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//topics/ajax-csrf-cors/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//topics/html-and-forms/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//topics/browser-enhancements/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//topics/browsable-api/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//topics/rest-hypermedia-hateoas/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
|
@ -289,115 +289,115 @@
|
|||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/tutorials-and-resources/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/third-party-packages/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/contributing/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/project-management/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/release-notes/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/3.9-announcement/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/3.8-announcement/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/3.7-announcement/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/3.6-announcement/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/3.5-announcement/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/3.4-announcement/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/3.3-announcement/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/3.2-announcement/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/3.1-announcement/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/3.0-announcement/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/kickstarter-announcement/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/mozilla-grant/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/funding/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org//community/jobs/</loc>
|
||||
<lastmod>2018-12-18</lastmod>
|
||||
<lastmod>2019-01-16</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
|
|
|
@ -496,7 +496,9 @@
|
|||
<h3 id="login-template"><a class="toclink" href="#login-template">Login Template</a></h3>
|
||||
<p>To add branding and customize the look-and-feel of the login template, create a template called <code>login.html</code> and add it to your project, eg: <code>templates/rest_framework/login.html</code>. The template should extend from <code>rest_framework/login_base.html</code>.</p>
|
||||
<p>You can add your site name or branding by including the branding block:</p>
|
||||
<pre><code>{% block branding %}
|
||||
<pre><code>{% extends "rest_framework/login_base.html" %}
|
||||
|
||||
{% block branding %}
|
||||
<h3 style="margin: 0 0 20px;">My Site Name</h3>
|
||||
{% endblock %}
|
||||
</code></pre>
|
||||
|
|
|
@ -605,20 +605,20 @@ class IsOwnerOrReadOnly(permissions.BasePermission):
|
|||
<p>When we interact with the API through the web browser, we can login, and the browser session will then provide the required authentication for the requests.</p>
|
||||
<p>If we're interacting with the API programmatically we need to explicitly provide the authentication credentials on each request.</p>
|
||||
<p>If we try to create a snippet without authenticating, we'll get an error:</p>
|
||||
<pre><code>http POST http://127.0.0.1:8000/snippets/ code="print 123"
|
||||
<pre><code>http POST http://127.0.0.1:8000/snippets/ code="print(123)"
|
||||
|
||||
{
|
||||
"detail": "Authentication credentials were not provided."
|
||||
}
|
||||
</code></pre>
|
||||
<p>We can make a successful request by including the username and password of one of the users we created earlier.</p>
|
||||
<pre><code>http -a admin:password123 POST http://127.0.0.1:8000/snippets/ code="print 789"
|
||||
<pre><code>http -a admin:password123 POST http://127.0.0.1:8000/snippets/ code="print(789)"
|
||||
|
||||
{
|
||||
"id": 1,
|
||||
"owner": "admin",
|
||||
"title": "foo",
|
||||
"code": "print 789",
|
||||
"code": "print(789)",
|
||||
"linenos": false,
|
||||
"language": "python",
|
||||
"style": "friendly"
|
||||
|
|
|
@ -491,7 +491,7 @@ $ find .
|
|||
./tutorial/urls.py
|
||||
./tutorial/wsgi.py
|
||||
</code></pre>
|
||||
<p>It may look unusual that the application has been created within the project directory. Using the project's namespace avoids name clashes with external module (topic goes outside the scope of the quickstart).</p>
|
||||
<p>It may look unusual that the application has been created within the project directory. Using the project's namespace avoids name clashes with external modules (a topic that goes outside the scope of the quickstart).</p>
|
||||
<p>Now sync your database for the first time:</p>
|
||||
<pre><code>python manage.py migrate
|
||||
</code></pre>
|
||||
|
@ -516,7 +516,7 @@ class GroupSerializer(serializers.HyperlinkedModelSerializer):
|
|||
model = Group
|
||||
fields = ('url', 'name')
|
||||
</code></pre>
|
||||
<p>Notice that we're using hyperlinked relations in this case, with <code>HyperlinkedModelSerializer</code>. You can also use primary key and various other relationships, but hyperlinking is good RESTful design.</p>
|
||||
<p>Notice that we're using hyperlinked relations in this case with <code>HyperlinkedModelSerializer</code>. You can also use primary key and various other relationships, but hyperlinking is good RESTful design.</p>
|
||||
<h2 id="views"><a class="toclink" href="#views">Views</a></h2>
|
||||
<p>Right, we'd better write some views then. Open <code>tutorial/quickstart/views.py</code> and get typing.</p>
|
||||
<pre><code>from django.contrib.auth.models import User, Group
|
||||
|
@ -543,7 +543,7 @@ class GroupViewSet(viewsets.ModelViewSet):
|
|||
<p>We can easily break these down into individual views if we need to, but using viewsets keeps the view logic nicely organized as well as being very concise.</p>
|
||||
<h2 id="urls"><a class="toclink" href="#urls">URLs</a></h2>
|
||||
<p>Okay, now let's wire up the API URLs. On to <code>tutorial/urls.py</code>...</p>
|
||||
<pre><code>from django.conf.urls import url, include
|
||||
<pre><code>from django.urls import include, path
|
||||
from rest_framework import routers
|
||||
from tutorial.quickstart import views
|
||||
|
||||
|
@ -554,15 +554,15 @@ router.register(r'groups', views.GroupViewSet)
|
|||
# Wire up our API using automatic URL routing.
|
||||
# Additionally, we include login URLs for the browsable API.
|
||||
urlpatterns = [
|
||||
url(r'^', include(router.urls)),
|
||||
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
|
||||
path('', include(router.urls)),
|
||||
path('api-auth/', include('rest_framework.urls', namespace='rest_framework'))
|
||||
]
|
||||
</code></pre>
|
||||
<p>Because we're using viewsets instead of views, we can automatically generate the URL conf for our API, by simply registering the viewsets with a router class.</p>
|
||||
<p>Again, if we need more control over the API URLs we can simply drop down to using regular class-based views, and writing the URL conf explicitly.</p>
|
||||
<p>Finally, we're including default login and logout views for use with the browsable API. That's optional, but useful if your API requires authentication and you want to use the browsable API.</p>
|
||||
<h2 id="pagination"><a class="toclink" href="#pagination">Pagination</a></h2>
|
||||
<p>Pagination allows you to control how many objects per page are returned. To enable it add following lines to the <code>tutorial/settings.py</code></p>
|
||||
<p>Pagination allows you to control how many objects per page are returned. To enable it add the following lines to <code>tutorial/settings.py</code></p>
|
||||
<pre><code>REST_FRAMEWORK = {
|
||||
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
||||
'PAGE_SIZE': 10
|
||||
|
|
Loading…
Reference in New Issue
Block a user