mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 03:23:59 +03:00
Latest docs build
This commit is contained in:
parent
f41354006f
commit
480b64d313
|
@ -6,7 +6,7 @@
|
||||||
<link href="http://django-rest-framework.org/img/favicon.ico" rel="icon" type="image/x-icon">
|
<link href="http://django-rest-framework.org/img/favicon.ico" rel="icon" type="image/x-icon">
|
||||||
<link rel="canonical" href="http://django-rest-framework.org/api-guide/relations"/>
|
<link rel="canonical" href="http://django-rest-framework.org/api-guide/relations"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="description" content="Django, API, REST, Serializer relations, API Reference, Nested relationships, Custom relational fields, Further notes">
|
<meta name="description" content="Django, API, REST, Serializer relations, API Reference, Nested relationships, Custom relational fields, Further notes, Third Party Packages">
|
||||||
<meta name="author" content="Tom Christie">
|
<meta name="author" content="Tom Christie">
|
||||||
|
|
||||||
<!-- Le styles -->
|
<!-- Le styles -->
|
||||||
|
@ -185,6 +185,8 @@
|
||||||
<li><a href="#manytomanyfields-with-a-through-model">ManyToManyFields with a Through Model</a></li>
|
<li><a href="#manytomanyfields-with-a-through-model">ManyToManyFields with a Through Model</a></li>
|
||||||
<li><a href="#advanced-hyperlinked-fields">Advanced Hyperlinked fields</a></li>
|
<li><a href="#advanced-hyperlinked-fields">Advanced Hyperlinked fields</a></li>
|
||||||
<li><a href="#deprecated-apis">Deprecated APIs</a></li>
|
<li><a href="#deprecated-apis">Deprecated APIs</a></li>
|
||||||
|
<li class="main"><a href="#third-party-packages">Third Party Packages</a></li>
|
||||||
|
<li><a href="#drf-nested-routers">DRF Nested Routers</a></li>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<hr>
|
<hr>
|
||||||
|
@ -578,6 +580,11 @@ They continue to function, but their usage will raise a <code>PendingDeprecation
|
||||||
<p>In the 2.3 release, these warnings will be escalated to a <code>DeprecationWarning</code>, which is loud by default.
|
<p>In the 2.3 release, these warnings will be escalated to a <code>DeprecationWarning</code>, which is loud by default.
|
||||||
In the 2.4 release, these parts of the API will be removed entirely.</p>
|
In the 2.4 release, these parts of the API will be removed entirely.</p>
|
||||||
<p>For more details see the <a href="../topics/2.2-announcement">2.2 release announcement</a>.</p>
|
<p>For more details see the <a href="../topics/2.2-announcement">2.2 release announcement</a>.</p>
|
||||||
|
<hr />
|
||||||
|
<h1 id="third-party-packages">Third Party Packages</h1>
|
||||||
|
<p>The following third party packages are also available.</p>
|
||||||
|
<h2 id="drf-nested-routers">DRF Nested Routers</h2>
|
||||||
|
<p>The <a href="https://github.com/alanjds/drf-nested-routers">drf-nested-routers package</a> provides routers and relationship fields for working with nested resources.</p>
|
||||||
</div><!--/span-->
|
</div><!--/span-->
|
||||||
</div><!--/row-->
|
</div><!--/row-->
|
||||||
</div><!--/.fluid-container-->
|
</div><!--/.fluid-container-->
|
||||||
|
|
|
@ -305,7 +305,7 @@ class GroupViewSet(viewsets.ModelViewSet):
|
||||||
model = Group
|
model = Group
|
||||||
|
|
||||||
|
|
||||||
# Routers provide an easy way of automatically determining the URL conf
|
# Routers provide an easy way of automatically determining the URL conf.
|
||||||
router = routers.DefaultRouter()
|
router = routers.DefaultRouter()
|
||||||
router.register(r'users', UserViewSet)
|
router.register(r'users', UserViewSet)
|
||||||
router.register(r'groups', GroupViewSet)
|
router.register(r'groups', GroupViewSet)
|
||||||
|
|
|
@ -384,6 +384,7 @@
|
||||||
<li>Alex Good - <a href="https://github.com/alexjg">alexjg</a></li>
|
<li>Alex Good - <a href="https://github.com/alexjg">alexjg</a></li>
|
||||||
<li>Ian Foote - <a href="https://github.com/ian-foote">ian-foote</a></li>
|
<li>Ian Foote - <a href="https://github.com/ian-foote">ian-foote</a></li>
|
||||||
<li>Chuck Harmston - <a href="https://github.com/chuckharmston">chuckharmston</a></li>
|
<li>Chuck Harmston - <a href="https://github.com/chuckharmston">chuckharmston</a></li>
|
||||||
|
<li>Philip Forget - <a href="https://github.com/philipforget">philipforget</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>Many thanks to everyone who's contributed to the project.</p>
|
<p>Many thanks to everyone who's contributed to the project.</p>
|
||||||
<h2 id="additional-thanks">Additional thanks</h2>
|
<h2 id="additional-thanks">Additional thanks</h2>
|
||||||
|
|
|
@ -247,7 +247,9 @@
|
||||||
<h3 id="master">Master</h3>
|
<h3 id="master">Master</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>JSON renderer now deals with objects that implement a dict-like interface.</li>
|
<li>JSON renderer now deals with objects that implement a dict-like interface.</li>
|
||||||
|
<li>Fix compatiblity with newer versions of <code>django-oauth-plus</code>.</li>
|
||||||
<li>Bugfix: Refine behavior that calls model manager <code>all()</code> across nested serializer relationships, preventing erronous behavior with some non-ORM objects, and preventing unneccessary queryset re-evaluations.</li>
|
<li>Bugfix: Refine behavior that calls model manager <code>all()</code> across nested serializer relationships, preventing erronous behavior with some non-ORM objects, and preventing unneccessary queryset re-evaluations.</li>
|
||||||
|
<li>Bugfix: Allow defaults on BooleanFields to be properly honored when values are not supplied.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h3 id="2310">2.3.10</h3>
|
<h3 id="2310">2.3.10</h3>
|
||||||
<p><strong>Date</strong>: 6th December 2013</p>
|
<p><strong>Date</strong>: 6th December 2013</p>
|
||||||
|
@ -288,7 +290,17 @@
|
||||||
<li>Bugfix: <code>client.force_authenticate(None)</code> should also clear session info if it exists.</li>
|
<li>Bugfix: <code>client.force_authenticate(None)</code> should also clear session info if it exists.</li>
|
||||||
<li>Bugfix: Client sending empty string instead of file now clears <code>FileField</code>.</li>
|
<li>Bugfix: Client sending empty string instead of file now clears <code>FileField</code>.</li>
|
||||||
<li>Bugfix: Empty values on ChoiceFields with <code>required=False</code> now consistently return <code>None</code>.</li>
|
<li>Bugfix: Empty values on ChoiceFields with <code>required=False</code> now consistently return <code>None</code>.</li>
|
||||||
|
<li>Bugfix: Clients setting <code>page=0</code> now simply returns the default page size, instead of disabling pagination. [*]</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<hr />
|
||||||
|
<p>[*] Note that the change in <code>page=0</code> behaviour fixes what is considered to be a bug in how clients can effect the pagination size. However if you were relying on this behavior you will need to add the following mixin to your list views in order to preserve the existing behavior.</p>
|
||||||
|
<pre class="prettyprint lang-py"><code>class DisablePaginationMixin(object):
|
||||||
|
def get_paginate_by(self, queryset=None):
|
||||||
|
if self.request.QUERY_PARAMS['self.paginate_by_param'] == '0':
|
||||||
|
return None
|
||||||
|
return super(DisablePaginationMixin, self).get_paginate_by(queryset)
|
||||||
|
</code></pre>
|
||||||
|
<hr />
|
||||||
<h3 id="237">2.3.7</h3>
|
<h3 id="237">2.3.7</h3>
|
||||||
<p><strong>Date</strong>: 16th August 2013</p>
|
<p><strong>Date</strong>: 16th August 2013</p>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -283,6 +283,8 @@ class GroupViewSet(viewsets.ModelViewSet):
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>Rather than write multiple views we're grouping together all the common behavior into classes called <code>ViewSets</code>.</p>
|
<p>Rather than write multiple views we're grouping together all the common behavior into classes called <code>ViewSets</code>.</p>
|
||||||
<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>
|
<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>
|
||||||
|
<p>Notice that our viewset classes here are a little different from those in the <a href="../#example">frontpage example</a>, as they include <code>queryset</code> and <code>serializer_class</code> attributes, instead of a <code>model</code> attribute.</p>
|
||||||
|
<p>For trivial cases you can simply set a <code>model</code> attribute on the <code>ViewSet</code> class and the serializer and queryset will be automatically generated for you. Setting the <code>queryset</code> and/or <code>serializer_class</code> attributes gives you more explicit control of the API behaviour, and is the recommended style for most applications.</p>
|
||||||
<h2 id="urls">URLs</h2>
|
<h2 id="urls">URLs</h2>
|
||||||
<p>Okay, now let's wire up the API URLs. On to <code>tutorial/urls.py</code>...</p>
|
<p>Okay, now let's wire up the API URLs. On to <code>tutorial/urls.py</code>...</p>
|
||||||
<pre class="prettyprint lang-py"><code>from django.conf.urls import patterns, url, include
|
<pre class="prettyprint lang-py"><code>from django.conf.urls import patterns, url, include
|
||||||
|
|
Loading…
Reference in New Issue
Block a user