Skip to content

Commit 1d65378

Browse files
committed
Update documentation
1 parent b23778b commit 1d65378

File tree

9 files changed

+19
-40
lines changed

9 files changed

+19
-40
lines changed

api-guide/fields/index.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,7 @@ <h3 id="myModalLabel">Documentation search</h3>
576576

577577

578578

579-
<hr />
580-
<p><strong>Note</strong>: This is the documentation for the <strong>version 3.0</strong> of REST framework. Documentation for <a href="http://tomchristie.github.io/rest-framework-2-docs/">version 2.4</a> is also available.</p>
581-
<hr />
582-
<h1 id="serializer-fields">Serializer fields</h1>
579+
<h1 id="serializer-fields">Serializer fields</h1>
583580
<blockquote>
584581
<p>Each field in a Form class is responsible not only for validating data, but also for "cleaning" it &mdash; normalizing it to a consistent format.</p>
585582
<p>&mdash; <a href="https://docs.djangoproject.com/en/dev/ref/forms/api/#django.forms.Form.cleaned_data">Django documentation</a></p>

api-guide/generic-views/index.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,10 +496,7 @@ <h3 id="myModalLabel">Documentation search</h3>
496496

497497

498498

499-
<hr />
500-
<p><strong>Note</strong>: This is the documentation for the <strong>version 3.0</strong> of REST framework. Documentation for <a href="http://tomchristie.github.io/rest-framework-2-docs/">version 2.4</a> is also available.</p>
501-
<hr />
502-
<h1 id="generic-views">Generic views</h1>
499+
<h1 id="generic-views">Generic views</h1>
503500
<blockquote>
504501
<p>Django’s generic views... were developed as a shortcut for common usage patterns... They take certain common idioms and patterns found in view development and abstract them so that you can quickly write common views of data without having to repeat yourself.</p>
505502
<p>&mdash; <a href="https://docs.djangoproject.com/en/dev/ref/class-based-views/#base-vs-generic-views">Django Documentation</a></p>

api-guide/metadata/index.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,7 @@ <h3 id="myModalLabel">Documentation search</h3>
388388

389389

390390

391-
<hr />
392-
<p><strong>Note</strong>: This is the documentation for the <strong>version 3.0</strong> of REST framework. Documentation for <a href="http://tomchristie.github.io/rest-framework-2-docs/">version 2.4</a> is also available.</p>
393-
<hr />
394-
<h1 id="metadata">Metadata</h1>
391+
<h1 id="metadata">Metadata</h1>
395392
<blockquote>
396393
<p>[The <code>OPTIONS</code>] method allows a client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.</p>
397394
<p>&mdash; <a href="http://tools.ietf.org/html/rfc7231#section-4.3.7">RFC7231, Section 4.3.7.</a></p>

api-guide/pagination/index.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -502,18 +502,18 @@ <h2 id="pagenumberpagination">PageNumberPagination</h2>
502502
}
503503
</code></pre>
504504
<h4 id="setup">Setup</h4>
505-
<p>To enable the <code>PageNumberPagination</code> style globally, use the following configuration, modifying the <code>DEFAULT_PAGE_SIZE</code> as desired:</p>
505+
<p>To enable the <code>PageNumberPagination</code> style globally, use the following configuration, modifying the <code>PAGE_SIZE</code> as desired:</p>
506506
<pre><code>REST_FRAMEWORK = {
507507
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
508-
'DEFAULT_PAGE_SIZE': 100
508+
'PAGE_SIZE': 100
509509
}
510510
</code></pre>
511511
<p>On <code>GenericAPIView</code> subclasses you may also set the <code>pagination_class</code> attribute to select <code>PageNumberPagination</code> on a per-view basis.</p>
512512
<h4 id="configuration">Configuration</h4>
513513
<p>The <code>PageNumberPagination</code> class includes a number of attributes that may be overridden to modify the pagination style.</p>
514514
<p>To set these attributes you should override the <code>PageNumberPagination</code> class, and then enable your custom pagination class as above.</p>
515515
<ul>
516-
<li><code>page_size</code> - A numeric value indicating the page size. If set, this overrides the <code>DEFAULT_PAGE_SIZE</code> setting. Defaults to the same value as the <code>DEFAULT_PAGE_SIZE</code> settings key.</li>
516+
<li><code>page_size</code> - A numeric value indicating the page size. If set, this overrides the <code>PAGE_SIZE</code> setting. Defaults to the same value as the <code>PAGE_SIZE</code> settings key.</li>
517517
<li><code>page_query_param</code> - A string value indicating the name of the query parameter to use for the pagination control.</li>
518518
<li><code>page_size_query_param</code> - If set, this is a string value indicating the name of a query parameter that allows the client to set the page size on a per-request basis. Defaults to <code>None</code>, indicating that the client may not control the requested page size.</li>
519519
<li><code>max_page_size</code> - If set, this is a numeric value indicating the maximum allowable requested page size. This attribute is only valid if <code>page_size_query_param</code> is also set.</li>
@@ -544,13 +544,13 @@ <h4 id="setup_1">Setup</h4>
544544
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination'
545545
}
546546
</code></pre>
547-
<p>Optionally, you may also set a <code>DEFAULT_PAGE_SIZE</code> key. If the <code>DEFAULT_PAGE_SIZE</code> parameter is also used then the <code>limit</code> query parameter will be optional, and may be omitted by the client.</p>
547+
<p>Optionally, you may also set a <code>PAGE_SIZE</code> key. If the <code>PAGE_SIZE</code> parameter is also used then the <code>limit</code> query parameter will be optional, and may be omitted by the client.</p>
548548
<p>On <code>GenericAPIView</code> subclasses you may also set the <code>pagination_class</code> attribute to select <code>LimitOffsetPagination</code> on a per-view basis.</p>
549549
<h4 id="configuration_1">Configuration</h4>
550550
<p>The <code>LimitOffsetPagination</code> class includes a number of attributes that may be overridden to modify the pagination style.</p>
551551
<p>To set these attributes you should override the <code>LimitOffsetPagination</code> class, and then enable your custom pagination class as above.</p>
552552
<ul>
553-
<li><code>default_limit</code> - A numeric value indicating the limit to use if one is not provided by the client in a query parameter. Defaults to the same value as the <code>DEFAULT_PAGE_SIZE</code> settings key.</li>
553+
<li><code>default_limit</code> - A numeric value indicating the limit to use if one is not provided by the client in a query parameter. Defaults to the same value as the <code>PAGE_SIZE</code> settings key.</li>
554554
<li><code>limit_query_param</code> - A string value indicating the name of the "limit" query parameter. Defaults to <code>'limit'</code>.</li>
555555
<li><code>offset_query_param</code> - A string value indicating the name of the "offset" query parameter. Defaults to <code>'offset'</code>.</li>
556556
<li><code>max_limit</code> - If set this is a numeric value indicating the maximum allowable limit that may be requested by the client. Defaults to <code>None</code>.</li>
@@ -566,7 +566,7 @@ <h2 id="cursorpagination">CursorPagination</h2>
566566
<li>Supports usage with very large datasets. With extremely large datasets pagination using offset-based pagination styles may become inefficient or unusable. Cursor based pagination schemes instead have fixed-time properties, and do not slow down as the dataset size increases.</li>
567567
</ul>
568568
<h4 id="details-and-limitations">Details and limitations</h4>
569-
<p>Proper use of cursor based pagination a little attention to detail. You'll need to think about what ordering you want the scheme to be applied against. The default is to order by <code>"-created"</code>. This assumes that <strong>there must be a 'created' timestamp field</strong> on the model instances, and will present a "timeline" style paginated view, with the most recently added items first.</p>
569+
<p>Proper use of cursor based pagination requires a little attention to detail. You'll need to think about what ordering you want the scheme to be applied against. The default is to order by <code>"-created"</code>. This assumes that <strong>there must be a 'created' timestamp field</strong> on the model instances, and will present a "timeline" style paginated view, with the most recently added items first.</p>
570570
<p>You can modify the ordering by overriding the <code>'ordering'</code> attribute on the pagination class, or by using the <code>OrderingFilter</code> filter class together with <code>CursorPagination</code>. When used with <code>OrderingFilter</code> you should strongly consider restricting the fields that the user may order by.</p>
571571
<p>Proper usage of cursor pagination should have an ordering field that satisfies the following:</p>
572572
<ul>
@@ -578,10 +578,10 @@ <h4 id="details-and-limitations">Details and limitations</h4>
578578
<p>Using an ordering field that does not satisfy these constraints will generally still work, but you'll be loosing some of the benefits of cursor pagination.</p>
579579
<p>For more technical details on the implementation we use for cursor pagination, the <a href="http://cramer.io/2011/03/08/building-cursors-for-the-disqus-api/">"Building cursors for the Disqus API"</a> blog post gives a good overview of the basic approach.</p>
580580
<h4 id="setup_2">Setup</h4>
581-
<p>To enable the <code>CursorPagination</code> style globally, use the following configuration, modifying the <code>DEFAULT_PAGE_SIZE</code> as desired:</p>
581+
<p>To enable the <code>CursorPagination</code> style globally, use the following configuration, modifying the <code>PAGE_SIZE</code> as desired:</p>
582582
<pre><code>REST_FRAMEWORK = {
583583
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.CursorPagination',
584-
'DEFAULT_PAGE_SIZE': 100
584+
'PAGE_SIZE': 100
585585
}
586586
</code></pre>
587587
<p>On <code>GenericAPIView</code> subclasses you may also set the <code>pagination_class</code> attribute to select <code>CursorPagination</code> on a per-view basis.</p>

api-guide/relations/index.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,10 +464,7 @@ <h3 id="myModalLabel">Documentation search</h3>
464464

465465

466466

467-
<hr />
468-
<p><strong>Note</strong>: This is the documentation for the <strong>version 3.0</strong> of REST framework. Documentation for <a href="http://tomchristie.github.io/rest-framework-2-docs/">version 2.4</a> is also available.</p>
469-
<hr />
470-
<h1 id="serializer-relations">Serializer relations</h1>
467+
<h1 id="serializer-relations">Serializer relations</h1>
471468
<blockquote>
472469
<p>Bad programmers worry about the code.
473470
Good programmers worry about data structures and their relationships.</p>

api-guide/requests/index.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,7 @@ <h3 id="myModalLabel">Documentation search</h3>
460460

461461

462462

463-
<hr />
464-
<p><strong>Note</strong>: This is the documentation for the <strong>version 3.0</strong> of REST framework. Documentation for <a href="http://tomchristie.github.io/rest-framework-2-docs/">version 2.4</a> is also available.</p>
465-
<hr />
466-
<h1 id="requests">Requests</h1>
463+
<h1 id="requests">Requests</h1>
467464
<blockquote>
468465
<p>If you're doing REST-based web service stuff ... you should ignore request.POST.</p>
469466
<p>&mdash; Malcom Tredinnick, <a href="https://groups.google.com/d/topic/django-developers/dxI4qVzrBY4/discussion">Django developers group</a></p>

api-guide/serializers/index.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,10 +552,7 @@ <h3 id="myModalLabel">Documentation search</h3>
552552

553553

554554

555-
<hr />
556-
<p><strong>Note</strong>: This is the documentation for the <strong>version 3.0</strong> of REST framework. Documentation for <a href="http://tomchristie.github.io/rest-framework-2-docs/">version 2.4</a> is also available.</p>
557-
<hr />
558-
<h1 id="serializers">Serializers</h1>
555+
<h1 id="serializers">Serializers</h1>
559556
<blockquote>
560557
<p>Expanding the usefulness of the serializers is something that we would
561558
like to address. However, it's not a trivial problem, and it

api-guide/validators/index.html

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,7 @@ <h3 id="myModalLabel">Documentation search</h3>
424424

425425

426426

427-
<hr />
428-
<p><strong>Note</strong>: This is the documentation for the <strong>version 3.0</strong> of REST framework. Documentation for <a href="http://tomchristie.github.io/rest-framework-2-docs/">version 2.4</a> is also available.</p>
429-
<hr />
430-
<h1 id="validators">Validators</h1>
427+
<h1 id="validators">Validators</h1>
431428
<blockquote>
432429
<p>Validators can be useful for re-using validation logic between different types of fields.</p>
433430
<p>&mdash; <a href="https://docs.djangoproject.com/en/dev/ref/validators/">Django documentation</a></p>
@@ -446,7 +443,7 @@ <h2 id="validation-in-rest-framework">Validation in REST framework</h2>
446443
<h4 id="example">Example</h4>
447444
<p>As an example of how REST framework uses explicit validation, we'll take a simple model class that has a field with a uniqueness constraint.</p>
448445
<pre><code>class CustomerReportRecord(models.Model):
449-
time_raised = models.DateTimeField(default=timezone.now, editable=False)
446+
time_raised = models.DateTimeField(default=timezone.now, editable=False)
450447
reference = models.CharField(unique=True, max_length=20)
451448
description = models.TextField()
452449
</code></pre>
@@ -455,7 +452,7 @@ <h4 id="example">Example</h4>
455452
class Meta:
456453
model = CustomerReportRecord
457454
</code></pre>
458-
<p>If we open up the Django shell using <code>manage.py shell</code> we can now </p>
455+
<p>If we open up the Django shell using <code>manage.py shell</code> we can now</p>
459456
<pre><code>&gt;&gt;&gt; from project.example.serializers import CustomerReportSerializer
460457
&gt;&gt;&gt; serializer = CustomerReportSerializer()
461458
&gt;&gt;&gt; print(repr(serializer))

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,8 @@ <h3 id="myModalLabel">Documentation search</h3>
461461
</p>
462462

463463
<hr />
464-
<p><strong>Note</strong>: This is the documentation for the <strong>version 3.0</strong> of REST framework. Documentation for <a href="http://tomchristie.github.io/rest-framework-2-docs/">version 2.4</a> is also available.</p>
465-
<p>For more details see the <a href="topics/3.0-announcement/">3.0 release notes</a>.</p>
464+
<p><strong>Note</strong>: This is the documentation for the <strong>version 3.1</strong> of REST framework. Documentation for <a href="http://tomchristie.github.io/rest-framework-2-docs/">version 2.4</a> is also available.</p>
465+
<p>For more details see the <a href="topics/3.1-announcement/">3.1 release notes</a>.</p>
466466
<hr />
467467
<p>
468468
<h1 style="position: absolute;

0 commit comments

Comments
 (0)