mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-29 21:14:01 +03:00
Update documentation
This commit is contained in:
parent
09d51ea4e2
commit
5e96a1ddf1
|
@ -589,7 +589,7 @@ class StandardResultsSetPagination(PageNumberPagination):
|
|||
<p>The <code>CursorPagination</code> class includes a number of attributes that may be overridden to modify the pagination style.</p>
|
||||
<p>To set these attributes you should override the <code>CursorPagination</code> class, and then enable your custom pagination class as above.</p>
|
||||
<ul>
|
||||
<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>
|
||||
<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>
|
||||
<li><code>cursor_query_param</code> = A string value indicating the name of the "cursor" query parameter. Defaults to <code>'cursor'</code>.</li>
|
||||
<li><code>ordering</code> = This should be a string, or list of strings, indicating the field against which the cursor based pagination will be applied. For example: <code>ordering = 'slug'</code>. Defaults to <code>-created</code>. This value may also be overridden by using <code>OrderingFilter</code> on the view.</li>
|
||||
<li><code>template</code> = The name of a template to use when rendering pagination controls in the browsable API. May be overridden to modify the rendering style, or set to <code>None</code> to disable HTML pagination controls completely. Defaults to <code>"rest_framework/pagination/previous_and_next.html"</code>.</li>
|
||||
|
|
|
@ -370,7 +370,7 @@
|
|||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#urlparameterversioning">URLParameterVersioning</a>
|
||||
<a href="#urlpathversioning">URLPathVersioning</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
@ -436,7 +436,9 @@
|
|||
</code></pre>
|
||||
<h4 id="reversing-urls-for-versioned-apis">Reversing URLs for versioned APIs</h4>
|
||||
<p>The <code>reverse</code> function included by REST framework ties in with the versioning scheme. You need to make sure to include the current <code>request</code> as a keyword argument, like so.</p>
|
||||
<pre><code>reverse('bookings-list', request=request)
|
||||
<pre><code>from rest_framework.reverse import reverse
|
||||
|
||||
reverse('bookings-list', request=request)
|
||||
</code></pre>
|
||||
<p>The above function will apply any URL transformations appropriate to the request version. For example:</p>
|
||||
<ul>
|
||||
|
@ -490,7 +492,7 @@ Accept: application/json; version=1.0
|
|||
Host: example.com
|
||||
Accept: application/vnd.megacorp.bookings+json; version=1.0
|
||||
</code></pre>
|
||||
<h2 id="urlparameterversioning">URLParameterVersioning</h2>
|
||||
<h2 id="urlpathversioning">URLPathVersioning</h2>
|
||||
<p>This scheme requires the client to specify the version as part of the URL path.</p>
|
||||
<pre><code>GET /v1/bookings/ HTTP/1.1
|
||||
Host: example.com
|
||||
|
|
|
@ -411,8 +411,23 @@
|
|||
</code></pre>
|
||||
<hr />
|
||||
<h2 id="30x-series">3.0.x series</h2>
|
||||
<h3 id="311">3.1.1</h3>
|
||||
<p><strong>Date</strong>: <a href="https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.1.1+Release%22">19th March 2015</a>.</p>
|
||||
<ul>
|
||||
<li><strong>Security fix</strong>: Escape tab switching cookie name in browsable API.</li>
|
||||
<li>Display input forms in browsable API if <code>serializer_class</code> is used, even when <code>get_serializer</code> method does not exist on the view. (<a href="../../gh2743">#2743</a>)</li>
|
||||
<li>Use a password input for the AuthTokenSerializer. (<a href="../../gh2741">#2741</a>)</li>
|
||||
<li>Fix missing anchor closing tag after next button. (<a href="https://github.com/tomchristie/django-rest-framework/issues/2691">#2691</a>)</li>
|
||||
<li>Fix <code>lookup_url_kwarg</code> handling in viewsets. (<a href="https://github.com/tomchristie/django-rest-framework/issues/2685">#2685</a>, <a href="https://github.com/tomchristie/django-rest-framework/issues/2591">#2591</a>)</li>
|
||||
<li>Fix problem with imporing <code>rest_framework.views</code> in <code>apps.py</code> (<a href="https://github.com/tomchristie/django-rest-framework/issues/2678">#2678</a>)</li>
|
||||
<li>LimitOffsetPagination raises <code>TypeError</code> if PAGE_SIZE not set (<a href="https://github.com/tomchristie/django-rest-framework/issues/2667">#2667</a>, <a href="https://github.com/tomchristie/django-rest-framework/issues/2700">#2700</a>)</li>
|
||||
<li>German translation for <code>min_value</code> field error message references <code>max_value</code>. (<a href="https://github.com/tomchristie/django-rest-framework/issues/2645">#2645</a>)</li>
|
||||
<li>Remove <code>MergeDict</code>. (<a href="https://github.com/tomchristie/django-rest-framework/issues/2640">#2640</a>)</li>
|
||||
<li>Support serializing unsaved models with related fields. (<a href="https://github.com/tomchristie/django-rest-framework/issues/2637">#2637</a>, <a href="https://github.com/tomchristie/django-rest-framework/issues/2641">#2641</a>)</li>
|
||||
<li>Allow blank/null on radio.html choices. (<a href="https://github.com/tomchristie/django-rest-framework/issues/2631">#2631</a>)</li>
|
||||
</ul>
|
||||
<h3 id="310">3.1.0</h3>
|
||||
<p><strong>Date</strong>: [5th March 2015][3.1.0-milestone].</p>
|
||||
<p><strong>Date</strong>: <a href="https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.1.0+Release%22">5th March 2015</a>.</p>
|
||||
<p>For full details see the <a href="../3.1-announcement">3.1 release announcement</a>.</p>
|
||||
<h3 id="305">3.0.5</h3>
|
||||
<p><strong>Date</strong>: <a href="https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.0.5+Release%22">10th February 2015</a>.</p>
|
||||
|
@ -507,7 +522,8 @@
|
|||
<p><!-- 3.0.2 -->
|
||||
<!-- 3.0.3 -->
|
||||
<!-- 3.0.4 -->
|
||||
<!-- 3.0.5 --></p>
|
||||
<!-- 3.0.5 -->
|
||||
<!-- 3.1.1 --></p>
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
|
|
|
@ -473,8 +473,10 @@ class UserSerializer(serializers.HyperlinkedModelSerializer):
|
|||
<li>Our user serializer includes a field that refers to <code>'snippet-detail'</code>.</li>
|
||||
<li>Our snippet and user serializers include <code>'url'</code> fields that by default will refer to <code>'{model_name}-detail'</code>, which in this case will be <code>'snippet-detail'</code> and <code>'user-detail'</code>.</li>
|
||||
</ul>
|
||||
<p>After adding all those names into our URLconf, our final <code>snippets/urls.py</code> file should look something like this:</p>
|
||||
<p>After adding all those names into our URLconf, our final <code>snippets/urls.py</code> file should look like this:</p>
|
||||
<pre><code>from django.conf.urls import url, include
|
||||
from rest_framework.urlpatterns import format_suffix_patterns
|
||||
from snippets import views
|
||||
|
||||
# API endpoints
|
||||
urlpatterns = format_suffix_patterns([
|
||||
|
|
Loading…
Reference in New Issue
Block a user