Skip to content

Commit 9d6bc0f

Browse files
committed
Deployed de497a9 with MkDocs version: 1.0.4
1 parent 843deb7 commit 9d6bc0f

File tree

85 files changed

+1026
-177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1026
-177
lines changed

404.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@
297297
<a href="/community/release-notes/">Release Notes</a>
298298
</li>
299299

300+
<li >
301+
<a href="/community/3.11-announcement/">3.11 Announcement</a>
302+
</li>
303+
300304
<li >
301305
<a href="/community/3.10-announcement/">3.10 Announcement</a>
302306
</li>

api-guide/authentication/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@
297297
<a href="../../community/release-notes/">Release Notes</a>
298298
</li>
299299

300+
<li >
301+
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
302+
</li>
303+
300304
<li >
301305
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
302306
</li>

api-guide/caching/index.html

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@
297297
<a href="../../community/release-notes/">Release Notes</a>
298298
</li>
299299

300+
<li >
301+
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
302+
</li>
303+
300304
<li >
301305
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
302306
</li>
@@ -438,11 +442,16 @@ <h2 id="using-cache-with-apiview-and-viewsets"><a class="toclink" href="#using-c
438442
decorators with class based views. This can be used with
439443
other cache decorators such as <a href="https://docs.djangoproject.com/en/dev/topics/cache/#the-per-view-cache"><code>cache_page</code></a> and
440444
<a href="https://docs.djangoproject.com/en/dev/topics/http/decorators/#django.views.decorators.vary.vary_on_cookie"><code>vary_on_cookie</code></a>.</p>
441-
<pre><code class="python">from rest_framework.response import Response
445+
<pre><code class="python">from django.utils.decorators import method_decorator
446+
from django.views.decorators.cache import cache_page
447+
from django.views.decorators.vary import vary_on_cookie
448+
449+
from rest_framework.response import Response
442450
from rest_framework.views import APIView
443451
from rest_framework import viewsets
444452

445-
class UserViewSet(viewsets.Viewset):
453+
454+
class UserViewSet(viewsets.ViewSet):
446455

447456
# Cache requested url for each user for 2 hours
448457
@method_decorator(cache_page(60*60*2))
@@ -453,6 +462,7 @@ <h2 id="using-cache-with-apiview-and-viewsets"><a class="toclink" href="#using-c
453462
}
454463
return Response(content)
455464

465+
456466
class PostView(APIView):
457467

458468
# Cache page for the requested url

api-guide/content-negotiation/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@
297297
<a href="../../community/release-notes/">Release Notes</a>
298298
</li>
299299

300+
<li >
301+
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
302+
</li>
303+
300304
<li >
301305
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
302306
</li>

api-guide/exceptions/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@
297297
<a href="../../community/release-notes/">Release Notes</a>
298298
</li>
299299

300+
<li >
301+
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
302+
</li>
303+
300304
<li >
301305
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
302306
</li>

api-guide/fields/index.html

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@
297297
<a href="../../community/release-notes/">Release Notes</a>
298298
</li>
299299

300+
<li >
301+
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
302+
</li>
303+
300304
<li >
301305
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
302306
</li>
@@ -660,8 +664,19 @@ <h3 id="required"><a class="toclink" href="#required"><code>required</code></a><
660664
<h3 id="default"><a class="toclink" href="#default"><code>default</code></a></h3>
661665
<p>If set, this gives the default value that will be used for the field if no input value is supplied. If not set the default behaviour is to not populate the attribute at all.</p>
662666
<p>The <code>default</code> is not applied during partial update operations. In the partial update case only fields that are provided in the incoming data will have a validated value returned.</p>
663-
<p>May be set to a function or other callable, in which case the value will be evaluated each time it is used. When called, it will receive no arguments. If the callable has a <code>set_context</code> method, that will be called each time before getting the value with the field instance as only argument. This works the same way as for <a href="../validators/#using-set_context">validators</a>.</p>
664-
<p>When serializing the instance, default will be used if the the object attribute or dictionary key is not present in the instance.</p>
667+
<p>May be set to a function or other callable, in which case the value will be evaluated each time it is used. When called, it will receive no arguments. If the callable has a <code>requires_context = True</code> attribute, then the serializer field will be passed as an argument.</p>
668+
<p>For example:</p>
669+
<pre><code>class CurrentUserDefault:
670+
"""
671+
May be applied as a `default=...` value on a serializer field.
672+
Returns the current user.
673+
"""
674+
requires_context = True
675+
676+
def __call__(self, serializer_field):
677+
return serializer_field.context['request'].user
678+
</code></pre>
679+
<p>When serializing the instance, default will be used if the object attribute or dictionary key is not present in the instance.</p>
665680
<p>Note that setting a <code>default</code> value implies that the field is not required. Including both the <code>default</code> and <code>required</code> keyword arguments is invalid and will raise an error.</p>
666681
<h3 id="allow_null"><a class="toclink" href="#allow_null"><code>allow_null</code></a></h3>
667682
<p>Normally an error will be raised if <code>None</code> is passed to a serializer field. Set this keyword argument to <code>True</code> if <code>None</code> should be considered a valid value.</p>
@@ -1141,7 +1156,7 @@ <h3 id="using-source"><a class="toclink" href="#using-source">Using <code>source
11411156
fields = ['label', 'coordinates']
11421157
</code></pre>
11431158
<p>Note that this example doesn't handle validation. Partly for that reason, in a
1144-
real project, the coordinate nesting might be better handled with a nested serialiser
1159+
real project, the coordinate nesting might be better handled with a nested serializer
11451160
using <code>source='*'</code>, with two <code>IntegerField</code> instances, each with their own <code>source</code>
11461161
pointing to the relevant field.</p>
11471162
<p>The key points from the example, though, are:</p>
@@ -1176,7 +1191,7 @@ <h3 id="using-source"><a class="toclink" href="#using-source">Using <code>source
11761191
</code></pre>
11771192
</li>
11781193
</ul>
1179-
<p>For completeness lets do the same thing again but with the nested serialiser
1194+
<p>For completeness lets do the same thing again but with the nested serializer
11801195
approach suggested above:</p>
11811196
<pre><code>class NestedCoordinateSerializer(serializers.Serializer):
11821197
x = serializers.IntegerField(source='x_coordinate')
@@ -1195,13 +1210,13 @@ <h3 id="using-source"><a class="toclink" href="#using-source">Using <code>source
11951210
declarations. It's our <code>NestedCoordinateSerializer</code> that takes <code>source='*'</code>.</p>
11961211
<p>Our new <code>DataPointSerializer</code> exhibits the same behaviour as the custom field
11971212
approach.</p>
1198-
<p>Serialising:</p>
1213+
<p>Serializing:</p>
11991214
<pre><code>&gt;&gt;&gt; out_serializer = DataPointSerializer(instance)
12001215
&gt;&gt;&gt; out_serializer.data
12011216
ReturnDict([('label', 'testing'),
12021217
('coordinates', OrderedDict([('x', 1), ('y', 2)]))])
12031218
</code></pre>
1204-
<p>Deserialising:</p>
1219+
<p>Deserializing:</p>
12051220
<pre><code>&gt;&gt;&gt; in_serializer = DataPointSerializer(data=data)
12061221
&gt;&gt;&gt; in_serializer.is_valid()
12071222
True
@@ -1226,8 +1241,8 @@ <h3 id="using-source"><a class="toclink" href="#using-source">Using <code>source
12261241
{'x': ['A valid integer is required.'],
12271242
'y': ['A valid integer is required.']})])
12281243
</code></pre>
1229-
<p>For this reason, the nested serialiser approach would be the first to try. You
1230-
would use the custom field approach when the nested serialiser becomes infeasible
1244+
<p>For this reason, the nested serializer approach would be the first to try. You
1245+
would use the custom field approach when the nested serializer becomes infeasible
12311246
or overly complex.</p>
12321247
<h1 id="third-party-packages"><a class="toclink" href="#third-party-packages">Third party packages</a></h1>
12331248
<p>The following third party packages are also available.</p>

api-guide/filtering/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@
297297
<a href="../../community/release-notes/">Release Notes</a>
298298
</li>
299299

300+
<li >
301+
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
302+
</li>
303+
300304
<li >
301305
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
302306
</li>

api-guide/format-suffixes/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@
297297
<a href="../../community/release-notes/">Release Notes</a>
298298
</li>
299299

300+
<li >
301+
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
302+
</li>
303+
300304
<li >
301305
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
302306
</li>

api-guide/generic-views/index.html

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@
297297
<a href="../../community/release-notes/">Release Notes</a>
298298
</li>
299299

300+
<li >
301+
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
302+
</li>
303+
300304
<li >
301305
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
302306
</li>
@@ -513,10 +517,6 @@ <h3 id="myModalLabel">Documentation search</h3>
513517
</li>
514518

515519

516-
<li>
517-
<a href="#django-rest-framework-bulk">Django REST Framework bulk</a>
518-
</li>
519-
520520
<li>
521521
<a href="#django-rest-multiple-models">Django Rest Multiple Models</a>
522522
</li>
@@ -798,8 +798,6 @@ <h1 id="put-as-create"><a class="toclink" href="#put-as-create">PUT as create</a
798798
<hr />
799799
<h1 id="third-party-packages"><a class="toclink" href="#third-party-packages">Third party packages</a></h1>
800800
<p>The following third party packages provide additional generic view implementations.</p>
801-
<h2 id="django-rest-framework-bulk"><a class="toclink" href="#django-rest-framework-bulk">Django REST Framework bulk</a></h2>
802-
<p>The <a href="https://github.com/miki725/django-rest-framework-bulk">django-rest-framework-bulk package</a> implements generic view mixins as well as some common concrete generic views to allow to apply bulk operations via API requests.</p>
803801
<h2 id="django-rest-multiple-models"><a class="toclink" href="#django-rest-multiple-models">Django Rest Multiple Models</a></h2>
804802
<p><a href="https://github.com/MattBroach/DjangoRestMultipleModels">Django Rest Multiple Models</a> provides a generic view (and mixin) for sending multiple serialized models and/or querysets via a single API request.</p>
805803

api-guide/metadata/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@
297297
<a href="../../community/release-notes/">Release Notes</a>
298298
</li>
299299

300+
<li >
301+
<a href="../../community/3.11-announcement/">3.11 Announcement</a>
302+
</li>
303+
300304
<li >
301305
<a href="../../community/3.10-announcement/">3.10 Announcement</a>
302306
</li>

0 commit comments

Comments
 (0)