mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-29 02:34:13 +03:00
Deployed 7ab4a58
with MkDocs version: 0.15.3
This commit is contained in:
parent
f6e5e58472
commit
face0d0124
|
@ -589,7 +589,7 @@ print token.key
|
|||
<p>If successfully authenticated, <code>TokenAuthentication</code> provides the following credentials.</p>
|
||||
<ul>
|
||||
<li><code>request.user</code> will be a Django <code>User</code> instance.</li>
|
||||
<li><code>request.auth</code> will be a <code>rest_framework.authtoken.models.BasicToken</code> instance.</li>
|
||||
<li><code>request.auth</code> will be a <code>rest_framework.authtoken.models.Token</code> instance.</li>
|
||||
</ul>
|
||||
<p>Unauthenticated responses that are denied permission will result in an <code>HTTP 401 Unauthorized</code> response with an appropriate WWW-Authenticate header. For example:</p>
|
||||
<pre><code>WWW-Authenticate: Token
|
||||
|
|
|
@ -727,7 +727,8 @@ class UserList(generics.ListCreateAPIView):
|
|||
queryset = self.filter_queryset(queryset) # Apply any filter backends
|
||||
filter = {}
|
||||
for field in self.lookup_fields:
|
||||
filter[field] = self.kwargs[field]
|
||||
if self.kwargs[field]: # Ignore empty fields.
|
||||
filter[field] = self.kwargs[field]
|
||||
return get_object_or_404(queryset, **filter) # Lookup the object
|
||||
</code></pre>
|
||||
<p>You can then simply apply this mixin to a view or viewset anytime you need to apply the custom behavior.</p>
|
||||
|
|
|
@ -928,7 +928,7 @@ serializer.data
|
|||
fields = ('id', 'account_name', 'users', 'created')
|
||||
</code></pre>
|
||||
<p>By default, all the model fields on the class will be mapped to a corresponding serializer fields.</p>
|
||||
<p>Any relationships such as foreign keys on the model will be mapped to <code>PrimaryKeyRelatedField</code>. Reverse relationships are not included by default unless explicitly included as described below.</p>
|
||||
<p>Any relationships such as foreign keys on the model will be mapped to <code>PrimaryKeyRelatedField</code>. Reverse relationships are not included by default unless explicitly included as specified in the <a href="../relations/">serializer relations</a> documentation.</p>
|
||||
<h4 id="inspecting-a-modelserializer"><a class="toclink" href="#inspecting-a-modelserializer">Inspecting a <code>ModelSerializer</code></a></h4>
|
||||
<p>Serializer classes generate helpful verbose representation strings, that allow you to fully inspect the state of their fields. This is particularly useful when working with <code>ModelSerializers</code> where you want to determine what set of fields and validators are being automatically created for you.</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>
|
||||
|
|
|
@ -572,7 +572,7 @@ class UploadView(APIView):
|
|||
|
||||
class RandomRateThrottle(throttling.BaseThrottle):
|
||||
def allow_request(self, request, view):
|
||||
return random.randint(1, 10) == 1
|
||||
return random.randint(1, 10) != 1
|
||||
</code></pre>
|
||||
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 20 KiB |
File diff suppressed because one or more lines are too long
112
sitemap.xml
112
sitemap.xml
|
@ -4,7 +4,7 @@
|
|||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
|
@ -13,49 +13,49 @@
|
|||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//tutorial/quickstart/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//tutorial/1-serialization/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//tutorial/2-requests-and-responses/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//tutorial/3-class-based-views/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//tutorial/4-authentication-and-permissions/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//tutorial/5-relationships-and-hyperlinked-apis/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//tutorial/6-viewsets-and-routers/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//tutorial/7-schemas-and-client-libraries/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
|
@ -65,163 +65,163 @@
|
|||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/requests/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/responses/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/views/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/generic-views/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/viewsets/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/routers/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/parsers/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/renderers/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/serializers/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/fields/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/relations/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/validators/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/authentication/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/permissions/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/throttling/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/filtering/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/pagination/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/versioning/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/content-negotiation/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/metadata/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/schemas/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/format-suffixes/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/reverse/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/exceptions/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/status-codes/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/testing/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//api-guide/settings/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
|
@ -231,121 +231,121 @@
|
|||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/documenting-your-api/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/api-clients/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/internationalization/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/ajax-csrf-cors/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/html-and-forms/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/browser-enhancements/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/browsable-api/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/rest-hypermedia-hateoas/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/third-party-resources/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/contributing/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/project-management/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/3.0-announcement/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/3.1-announcement/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/3.2-announcement/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/3.3-announcement/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/3.4-announcement/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/kickstarter-announcement/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/mozilla-grant/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/funding/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://www.django-rest-framework.org//topics/release-notes/</loc>
|
||||
<lastmod>2016-08-25</lastmod>
|
||||
<lastmod>2016-09-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
|
|
|
@ -446,6 +446,17 @@
|
|||
</code></pre>
|
||||
<hr />
|
||||
<h2 id="34x-series"><a class="toclink" href="#34x-series">3.4.x series</a></h2>
|
||||
<h3 id="347"><a class="toclink" href="#347">3.4.7</a></h3>
|
||||
<p><strong>Date</strong>: <a href="https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.4.7+Release%22">21st September 2016</a></p>
|
||||
<ul>
|
||||
<li>Fallback behavior for request parsing when request.POST already accessed. (<a href="https://github.com/tomchristie/django-rest-framework/issues/3951">#3951</a>, <a href="https://github.com/tomchristie/django-rest-framework/issues/4500">#4500</a>)</li>
|
||||
<li>Fix regression of <code>RegexField</code>. (<a href="https://github.com/tomchristie/django-rest-framework/issues/4489">#4489</a>, <a href="https://github.com/tomchristie/django-rest-framework/issues/4490">#4490</a>, <a href="https://github.com/tomchristie/django-rest-framework/issues/2617">#2617</a>)</li>
|
||||
<li>Missing comma in <code>admin.html</code> causing CSRF error. (<a href="https://github.com/tomchristie/django-rest-framework/issues/4472">#4472</a>, <a href="https://github.com/tomchristie/django-rest-framework/issues/4473">#4473</a>)</li>
|
||||
<li>Fix response rendering with empty context. (<a href="https://github.com/tomchristie/django-rest-framework/issues/4495">#4495</a>)</li>
|
||||
<li>Fix indentation regression in API listing. (<a href="https://github.com/tomchristie/django-rest-framework/issues/4493">#4493</a>)</li>
|
||||
<li>Fixed an issue where the incorrect value is set to <code>ResolverMatch.func_name</code> of api_view decorated view. (<a href="https://github.com/tomchristie/django-rest-framework/issues/4465">#4465</a>, <a href="https://github.com/tomchristie/django-rest-framework/issues/4462">#4462</a>)</li>
|
||||
<li>Fix <code>APIClient.get()</code> when path contains unicode arguments (<a href="https://github.com/tomchristie/django-rest-framework/issues/4458">#4458</a>)</li>
|
||||
</ul>
|
||||
<h3 id="346"><a class="toclink" href="#346">3.4.6</a></h3>
|
||||
<p><strong>Date</strong>: <a href="https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.4.6+Release%22">23rd August 2016</a></p>
|
||||
<ul>
|
||||
|
@ -950,6 +961,8 @@
|
|||
<!-- 3.4.5 -->
|
||||
|
||||
<!-- 3.4.6 -->
|
||||
|
||||
<!-- 3.4.7 -->
|
||||
|
||||
|
||||
</div> <!--/span-->
|
||||
|
|
Loading…
Reference in New Issue
Block a user