django-rest-framework/topics/release-notes/index.html
2014-12-05 09:44:35 +00:00

980 lines
50 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>Release Notes - Django REST framework</title>
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/release-notes/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Release Notes">
<meta name="author" content="Tom Christie">
<!-- Le styles -->
<link href="../../css/prettify.css" rel="stylesheet">
<link href="../../css/bootstrap.css" rel="stylesheet">
<link href="../../css/bootstrap-responsive.css" rel="stylesheet">
<link href="../../css/default.css" rel="stylesheet">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-18852272-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
<style>
span.fusion-wrap a {
display: block;
margin-top: 10px;
color: black;
}
a.fusion-poweredby {
display: block;
margin-top: 10px;
}
@media (max-width: 767px) {
div.promo {
display: none;
}
}
</style>
</head>
<body onload="prettyPrint()" class="-page">
<div class="wrapper">
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../credits">
Next <i class="icon-arrow-right icon-white"></i>
</a>
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../kickstarter-announcement">
<i class="icon-arrow-left icon-white"></i> Previous
</a>
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
<ul class="nav navbar-nav">
<li ><a href="/">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../tutorial/quickstart">Quickstart</a>
</li>
<li >
<a href="../../tutorial/1-serialization">1 - Serialization</a>
</li>
<li >
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
</li>
<li >
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
</li>
<li >
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
</li>
<li >
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
</li>
<li >
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">API Guide <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../../api-guide/requests">Requests</a>
</li>
<li >
<a href="../../api-guide/responses">Responses</a>
</li>
<li >
<a href="../../api-guide/views">Views</a>
</li>
<li >
<a href="../../api-guide/generic-views">Generic views</a>
</li>
<li >
<a href="../../api-guide/viewsets">Viewsets</a>
</li>
<li >
<a href="../../api-guide/routers">Routers</a>
</li>
<li >
<a href="../../api-guide/parsers">Parsers</a>
</li>
<li >
<a href="../../api-guide/renderers">Renderers</a>
</li>
<li >
<a href="../../api-guide/serializers">Serializers</a>
</li>
<li >
<a href="../../api-guide/fields">Serializer fields</a>
</li>
<li >
<a href="../../api-guide/relations">Serializer relations</a>
</li>
<li >
<a href="../../api-guide/validators">Validators</a>
</li>
<li >
<a href="../../api-guide/authentication">Authentication</a>
</li>
<li >
<a href="../../api-guide/permissions">Permissions</a>
</li>
<li >
<a href="../../api-guide/throttling">Throttling</a>
</li>
<li >
<a href="../../api-guide/filtering">Filtering</a>
</li>
<li >
<a href="../../api-guide/pagination">Pagination</a>
</li>
<li >
<a href="../../api-guide/content-negotiation">Content negotiation</a>
</li>
<li >
<a href="../../api-guide/format-suffixes">Format suffixes</a>
</li>
<li >
<a href="../../api-guide/reverse">Returning URLs</a>
</li>
<li >
<a href="../../api-guide/exceptions">Exceptions</a>
</li>
<li >
<a href="../../api-guide/status-codes">Status codes</a>
</li>
<li >
<a href="../../api-guide/testing">Testing</a>
</li>
<li >
<a href="../../api-guide/settings">Settings</a>
</li>
</ul>
</li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../documenting-your-api">Documenting your API</a>
</li>
<li >
<a href="../ajax-csrf-cors">AJAX, CSRF & CORS</a>
</li>
<li >
<a href="../browser-enhancements">Browser enhancements</a>
</li>
<li >
<a href="../browsable-api">The Browsable API</a>
</li>
<li >
<a href="../rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
</li>
<li >
<a href="../third-party-resources">Third Party Resources</a>
</li>
<li >
<a href="../contributing">Contributing to REST framework</a>
</li>
<li >
<a href="../rest-framework-2-announcement">2.0 Announcement</a>
</li>
<li >
<a href="../2.2-announcement">2.2 Announcement</a>
</li>
<li >
<a href="../2.3-announcement">2.3 Announcement</a>
</li>
<li >
<a href="../2.4-announcement">2.4 Announcement</a>
</li>
<li >
<a href="../3.0-announcement">3.0 Announcement</a>
</li>
<li >
<a href="../kickstarter-announcement">Kickstarter Announcement</a>
</li>
<li class="active" >
<a href=".">Release Notes</a>
</li>
<li >
<a href="../credits">Credits</a>
</li>
</ul>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
</div>
<div class="body-content">
<div class="container-fluid">
<!-- Search Modal -->
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3 id="myModalLabel">Documentation search</h3>
</div>
<div class="modal-body">
<!-- Custom google search -->
<script>
(function() {
var cx = '015016005043623903336:rxraeohqk6w';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:search></gcse:search>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
<div class="row-fluid">
<div class="span3">
<!-- TODO
<p style="margin-top: -12px">
<a class="btn btn-mini btn-primary" style="width: 60px">&laquo; previous</a>
<a class="btn btn-mini btn-primary" style="float: right; margin-right: 8px; width: 60px;">next &raquo;</a>
</p>
-->
<div id="table-of-contents">
<ul class="nav nav-list side-nav well sidebar-nav-fixed">
<li class="main">
<a href="#release-notes">Release Notes</a>
</li>
<li>
<a href="#versioning">Versioning</a>
</li>
<li>
<a href="#deprecation-policy">Deprecation policy</a>
</li>
<li>
<a href="#upgrading">Upgrading</a>
</li>
<li>
<a href="#24x-series">2.4.x series</a>
</li>
<li>
<a href="#23x-series">2.3.x series</a>
</li>
<li>
<a href="#22x-series">2.2.x series</a>
</li>
<li>
<a href="#21x-series">2.1.x series</a>
</li>
<li>
<a href="#20x-series">2.0.x series</a>
</li>
</ul>
</div>
</div>
<div id="main-content" class="span9">
<h1 id="release-notes">Release Notes</h1>
<blockquote>
<p>Release Early, Release Often</p>
<p>&mdash; Eric S. Raymond, <a href="http://www.catb.org/~esr/writings/cathedral-bazaar/cathedral-bazaar/ar01s04.html">The Cathedral and the Bazaar</a>.</p>
</blockquote>
<h2 id="versioning">Versioning</h2>
<p>Minor version numbers (0.0.x) are used for changes that are API compatible. You should be able to upgrade between minor point releases without any other code changes.</p>
<p>Medium version numbers (0.x.0) may include API changes, in line with the <a href="#deprecation-policy">deprecation policy</a>. You should read the release notes carefully before upgrading between medium point releases.</p>
<p>Major version numbers (x.0.0) are reserved for substantial project milestones.</p>
<h2 id="deprecation-policy">Deprecation policy</h2>
<p>REST framework releases follow a formal deprecation policy, which is in line with <a href="https://docs.djangoproject.com/en/dev/internals/release-process/#internal-release-deprecation-policy">Django's deprecation policy</a>.</p>
<p>The timeline for deprecation of a feature present in version 1.0 would work as follows:</p>
<ul>
<li>
<p>Version 1.1 would remain <strong>fully backwards compatible</strong> with 1.0, but would raise <code>PendingDeprecationWarning</code> warnings if you use the feature that are due to be deprecated. These warnings are <strong>silent by default</strong>, but can be explicitly enabled when you're ready to start migrating any required changes. For example if you start running your tests using <code>python -Wd manage.py test</code>, you'll be warned of any API changes you need to make.</p>
</li>
<li>
<p>Version 1.2 would escalate these warnings to <code>DeprecationWarning</code>, which is loud by default.</p>
</li>
<li>
<p>Version 1.3 would remove the deprecated bits of API entirely.</p>
</li>
</ul>
<p>Note that in line with Django's policy, any parts of the framework not mentioned in the documentation should generally be considered private API, and may be subject to change.</p>
<h2 id="upgrading">Upgrading</h2>
<p>To upgrade Django REST framework to the latest version, use pip:</p>
<pre><code>pip install -U djangorestframework
</code></pre>
<p>You can determine your currently installed version using <code>pip freeze</code>:</p>
<pre><code>pip freeze | grep djangorestframework
</code></pre>
<hr />
<h2 id="24x-series">2.4.x series</h2>
<h3 id="244">2.4.4</h3>
<p><strong>Date</strong>: <a href="https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%222.4.4+Release%22+">3rd November 2014</a>.</p>
<ul>
<li><strong>Security fix</strong>: Escape URLs when replacing <code>format=</code> query parameter, as used in dropdown on <code>GET</code> button in browsable API to allow explicit selection of JSON vs HTML output.</li>
<li>Maintain ordering of URLs in API root view for <code>DefaultRouter</code>.</li>
<li>Fix <code>follow=True</code> in <code>APIRequestFactory</code></li>
<li>Resolve issue with invalid <code>read_only=True</code>, <code>required=True</code> fields being automatically generated by <code>ModelSerializer</code> in some cases.</li>
<li>Resolve issue with <code>OPTIONS</code> requests returning incorrect information for views using <code>get_serializer_class</code> to dynamically determine serializer based on request method. </li>
</ul>
<h3 id="243">2.4.3</h3>
<p><strong>Date</strong>: <a href="https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%222.4.3+Release%22+">19th September 2014</a>.</p>
<ul>
<li>Support translatable view docstrings being displayed in the browsable API.</li>
<li>Support <a href="http://tools.ietf.org/html/rfc6266#section-4.3">encoded <code>filename*</code></a> in raw file uploads with <code>FileUploadParser</code>.</li>
<li>Allow routers to support viewsets that don't include any list routes or that don't include any detail routes.</li>
<li>Don't render an empty login control in browsable API if <code>login</code> view is not included.</li>
<li>CSRF exemption performed in <code>.as_view()</code> to prevent accidental omission if overriding <code>.dispatch()</code>.</li>
<li>Login on browsable API now displays validation errors.</li>
<li>Bugfix: Fix migration in <code>authtoken</code> application.</li>
<li>Bugfix: Allow selection of integer keys in nested choices.</li>
<li>Bugfix: Return <code>None</code> instead of <code>'None'</code> in <code>CharField</code> with <code>allow_none=True</code>.</li>
<li>Bugfix: Ensure custom model fields map to equivelent serializer fields more reliably.</li>
<li>Bugfix: <code>DjangoFilterBackend</code> no longer quietly changes queryset ordering.</li>
</ul>
<h3 id="242">2.4.2</h3>
<p><strong>Date</strong>: <a href="https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%222.4.2+Release%22+">3rd September 2014</a>.</p>
<ul>
<li>Bugfix: Fix broken pagination for 2.4.x series.</li>
</ul>
<h3 id="241">2.4.1</h3>
<p><strong>Date</strong>: <a href="https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%222.4.1+Release%22+">1st September 2014</a>.</p>
<ul>
<li>Bugfix: Fix broken login template for browsable API.</li>
</ul>
<h3 id="240">2.4.0</h3>
<p><strong>Date</strong>: <a href="https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%222.4.0+Release%22+">29th August 2014</a>.</p>
<p><strong>Django version requirements</strong>: The lowest supported version of Django is now 1.4.2.</p>
<p><strong>South version requirements</strong>: This note applies to any users using the optional <code>authtoken</code> application, which includes an associated database migration. You must now <em>either</em> upgrade your <code>south</code> package to version 1.0, <em>or</em> instead use the built-in migration support available with Django 1.7.</p>
<ul>
<li>Added compatibility with Django 1.7's database migration support.</li>
<li>New test runner, using <code>py.test</code>.</li>
<li>Deprecated <code>.model</code> view attribute in favor of explicit <code>.queryset</code> and <code>.serializer_class</code> attributes. The <code>DEFAULT_MODEL_SERIALIZER_CLASS</code> setting is also deprecated.</li>
<li><code>@detail_route</code> and <code>@list_route</code> decorators replace <code>@action</code> and <code>@link</code>.</li>
<li>Support customizable view name and description functions, using the <code>VIEW_NAME_FUNCTION</code> and <code>VIEW_DESCRIPTION_FUNCTION</code> settings.</li>
<li>Added <code>NUM_PROXIES</code> setting for smarter client IP identification.</li>
<li>Added <code>MAX_PAGINATE_BY</code> setting and <code>max_paginate_by</code> generic view attribute.</li>
<li>Added <code>Retry-After</code> header to throttled responses, as per <a href="http://tools.ietf.org/html/rfc6585">RFC 6585</a>. This should now be used in preference to the custom <code>X-Trottle-Wait-Seconds</code> header which will be fully deprecated in 3.0.</li>
<li>Added <code>cache</code> attribute to throttles to allow overriding of default cache.</li>
<li>Added <code>lookup_value_regex</code> attribute to routers, to allow the URL argument matching to be constrainted by the user.</li>
<li>Added <code>allow_none</code> option to <code>CharField</code>.</li>
<li>Support Django's standard <code>status_code</code> class attribute on responses.</li>
<li>More intuitive behavior on the test client, as <code>client.logout()</code> now also removes any credentials that have been set.</li>
<li>Bugfix: <code>?page_size=0</code> query parameter now falls back to default page size for view, instead of always turning pagination off.</li>
<li>Bugfix: Always uppercase <code>X-Http-Method-Override</code> methods.</li>
<li>Bugfix: Copy <code>filter_backends</code> list before returning it, in order to prevent view code from mutating the class attribute itself.</li>
<li>Bugfix: Set the <code>.action</code> attribute on viewsets when introspected by <code>OPTIONS</code> for testing permissions on the view.</li>
<li>Bugfix: Ensure <code>ValueError</code> raised during deserialization results in a error list rather than a single error. This is now consistent with other validation errors.</li>
<li>Bugfix: Fix <code>cache_format</code> typo on throttle classes, was <code>"throtte_%(scope)s_%(ident)s"</code>. Note that this will invalidate existing throttle caches.</li>
</ul>
<hr />
<h2 id="23x-series">2.3.x series</h2>
<h3 id="2314">2.3.14</h3>
<p><strong>Date</strong>: 12th June 2014</p>
<ul>
<li><strong>Security fix</strong>: Escape request path when it is include as part of the login and logout links in the browsable API.</li>
<li><code>help_text</code> and <code>verbose_name</code> automatically set for related fields on <code>ModelSerializer</code>.</li>
<li>Fix nested serializers linked through a backward foreign key relation.</li>
<li>Fix bad links for the <code>BrowsableAPIRenderer</code> with <code>YAMLRenderer</code>.</li>
<li>Add <code>UnicodeYAMLRenderer</code> that extends <code>YAMLRenderer</code> with unicode.</li>
<li>Fix <code>parse_header</code> argument convertion.</li>
<li>Fix mediatype detection under Python 3.</li>
<li>Web browsable API now offers blank option on dropdown when the field is not required.</li>
<li><code>APIException</code> representation improved for logging purposes.</li>
<li>Allow source="*" within nested serializers.</li>
<li>Better support for custom oauth2 provider backends.</li>
<li>Fix field validation if it's optional and has no value.</li>
<li>Add <code>SEARCH_PARAM</code> and <code>ORDERING_PARAM</code>.</li>
<li>Fix <code>APIRequestFactory</code> to support arguments within the url string for GET.</li>
<li>Allow three transport modes for access tokens when accessing a protected resource.</li>
<li>Fix <code>QueryDict</code> encoding on request objects.</li>
<li>Ensure throttle keys do not contain spaces, as those are invalid if using <code>memcached</code>.</li>
<li>Support <code>blank_display_value</code> on <code>ChoiceField</code>.</li>
</ul>
<h3 id="2313">2.3.13</h3>
<p><strong>Date</strong>: 6th March 2014</p>
<ul>
<li>Django 1.7 Support.</li>
<li>Fix <code>default</code> argument when used with serializer relation fields.</li>
<li>Display the media type of the content that is being displayed in the browsable API, rather than 'text/html'.</li>
<li>Bugfix for <code>urlize</code> template failure when URL regex is matched, but value does not <code>urlparse</code>.</li>
<li>Use <code>urandom</code> for token generation.</li>
<li>Only use <code>Vary: Accept</code> when more than one renderer exists.</li>
</ul>
<h3 id="2312">2.3.12</h3>
<p><strong>Date</strong>: 15th January 2014</p>
<ul>
<li><strong>Security fix</strong>: <code>OrderingField</code> now only allows ordering on readable serializer fields, or on fields explicitly specified using <code>ordering_fields</code>. This prevents users being able to order by fields that are not visible in the API, and exploiting the ordering of sensitive data such as password hashes.</li>
<li>Bugfix: <code>write_only = True</code> fields now display in the browsable API.</li>
</ul>
<h3 id="2311">2.3.11</h3>
<p><strong>Date</strong>: 14th January 2014</p>
<ul>
<li>Added <code>write_only</code> serializer field argument.</li>
<li>Added <code>write_only_fields</code> option to <code>ModelSerializer</code> classes.</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 unnecessary queryset re-evaluations.</li>
<li>Bugfix: Allow defaults on BooleanFields to be properly honored when values are not supplied.</li>
<li>Bugfix: Prevent double-escaping of non-latin1 URL query params when appending <code>format=json</code> params.</li>
</ul>
<h3 id="2310">2.3.10</h3>
<p><strong>Date</strong>: 6th December 2013</p>
<ul>
<li>Add in choices information for ChoiceFields in response to <code>OPTIONS</code> requests.</li>
<li>Added <code>pre_delete()</code> and <code>post_delete()</code> method hooks.</li>
<li>Added status code category helper functions.</li>
<li>Bugfix: Partial updates which erronously set a related field to <code>None</code> now correctly fail validation instead of raising an exception.</li>
<li>Bugfix: Responses without any content no longer include an HTTP <code>'Content-Type'</code> header.</li>
<li>Bugfix: Correctly handle validation errors in PUT-as-create case, responding with 400.</li>
</ul>
<h3 id="239">2.3.9</h3>
<p><strong>Date</strong>: 15th November 2013</p>
<ul>
<li>Fix Django 1.6 exception API compatibility issue caused by <code>ValidationError</code>.</li>
<li>Include errors in HTML forms in browsable API.</li>
<li>Added JSON renderer support for numpy scalars.</li>
<li>Added <code>transform_&lt;fieldname&gt;</code> hooks on serializers for easily modifying field output.</li>
<li>Added <code>get_context</code> hook in <code>BrowsableAPIRenderer</code>.</li>
<li>Allow serializers to be passed <code>files</code> but no <code>data</code>.</li>
<li><code>HTMLFormRenderer</code> now renders serializers directly to HTML without needing to create an intermediate form object.</li>
<li>Added <code>get_filter_backends</code> hook.</li>
<li>Added queryset aggregates to allowed fields in <code>OrderingFilter</code>.</li>
<li>Bugfix: Fix decimal suppoprt with <code>YAMLRenderer</code>.</li>
<li>Bugfix: Fix submission of unicode in browsable API through raw data form.</li>
</ul>
<h3 id="238">2.3.8</h3>
<p><strong>Date</strong>: 11th September 2013</p>
<ul>
<li>Added <code>DjangoObjectPermissions</code>, and <code>DjangoObjectPermissionsFilter</code>.</li>
<li>Support customizable exception handling, using the <code>EXCEPTION_HANDLER</code> setting.</li>
<li>Support customizable view name and description functions, using the <code>VIEW_NAME_FUNCTION</code> and <code>VIEW_DESCRIPTION_FUNCTION</code> settings.</li>
<li>Added <code>MAX_PAGINATE_BY</code> setting and <code>max_paginate_by</code> generic view attribute.</li>
<li>Added <code>cache</code> attribute to throttles to allow overriding of default cache.</li>
<li>'Raw data' tab in browsable API now contains pre-populated data.</li>
<li>'Raw data' and 'HTML form' tab preference in browsable API now saved between page views.</li>
<li>Bugfix: <code>required=True</code> argument fixed for boolean serializer fields.</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: Empty values on ChoiceFields with <code>required=False</code> now consistently return <code>None</code>.</li>
<li>Bugfix: Clients setting <code>page_size=0</code> now simply returns the default page size, instead of disabling pagination. [*]</li>
</ul>
<hr />
<p>[*] Note that the change in <code>page_size=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><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>
<p><strong>Date</strong>: 16th August 2013</p>
<ul>
<li>Added <code>APITestClient</code>, <code>APIRequestFactory</code> and <code>APITestCase</code> etc...</li>
<li>Refactor <code>SessionAuthentication</code> to allow esier override for CSRF exemption.</li>
<li>Remove 'Hold down "Control" message from help_text' widget messaging when not appropriate.</li>
<li>Added admin configuration for auth tokens.</li>
<li>Bugfix: <code>AnonRateThrottle</code> fixed to not throttle authenticated users.</li>
<li>Bugfix: Don't set <code>X-Throttle-Wait-Seconds</code> when throttle does not have <code>wait</code> value.</li>
<li>Bugfix: Fixed <code>PATCH</code> button title in browsable API.</li>
<li>Bugfix: Fix issue with OAuth2 provider naive datetimes.</li>
</ul>
<h3 id="236">2.3.6</h3>
<p><strong>Date</strong>: 27th June 2013</p>
<ul>
<li>Added <code>trailing_slash</code> option to routers.</li>
<li>Include support for <code>HttpStreamingResponse</code>.</li>
<li>Support wider range of default serializer validation when used with custom model fields.</li>
<li>UTF-8 Support for browsable API descriptions.</li>
<li>OAuth2 provider uses timezone aware datetimes when supported.</li>
<li>Bugfix: Return error correctly when OAuth non-existent consumer occurs.</li>
<li>Bugfix: Allow <code>FileUploadParser</code> to correctly filename if provided as URL kwarg.</li>
<li>Bugfix: Fix <code>ScopedRateThrottle</code>.</li>
</ul>
<h3 id="235">2.3.5</h3>
<p><strong>Date</strong>: 3rd June 2013</p>
<ul>
<li>Added <code>get_url</code> hook to <code>HyperlinkedIdentityField</code>.</li>
<li>Serializer field <code>default</code> argument may be a callable.</li>
<li><code>@action</code> decorator now accepts a <code>methods</code> argument.</li>
<li>Bugfix: <code>request.user</code> should be still be accessible in renderer context if authentication fails.</li>
<li>Bugfix: The <code>lookup_field</code> option on <code>HyperlinkedIdentityField</code> should apply by default to the url field on the serializer.</li>
<li>Bugfix: <code>HyperlinkedIdentityField</code> should continue to support <code>pk_url_kwarg</code>, <code>slug_url_kwarg</code>, <code>slug_field</code>, in a pending deprecation state.</li>
<li>Bugfix: Ensure we always return 404 instead of 500 if a lookup field cannot be converted to the correct lookup type. (Eg non-numeric <code>AutoInteger</code> pk lookup)</li>
</ul>
<h3 id="234">2.3.4</h3>
<p><strong>Date</strong>: 24th May 2013</p>
<ul>
<li>Serializer fields now support <code>label</code> and <code>help_text</code>.</li>
<li>Added <code>UnicodeJSONRenderer</code>.</li>
<li><code>OPTIONS</code> requests now return metadata about fields for <code>POST</code> and <code>PUT</code> requests.</li>
<li>Bugfix: <code>charset</code> now properly included in <code>Content-Type</code> of responses.</li>
<li>Bugfix: Blank choice now added in browsable API on nullable relationships.</li>
<li>Bugfix: Many to many relationships with <code>through</code> tables are now read-only.</li>
<li>Bugfix: Serializer fields now respect model field args such as <code>max_length</code>.</li>
<li>Bugfix: SlugField now performs slug validation.</li>
<li>Bugfix: Lazy-translatable strings now properly serialized.</li>
<li>Bugfix: Browsable API now supports bootswatch styles properly.</li>
<li>Bugfix: HyperlinkedIdentityField now uses <code>lookup_field</code> kwarg.</li>
</ul>
<p><strong>Note</strong>: Responses now correctly include an appropriate charset on the <code>Content-Type</code> header. For example: <code>application/json; charset=utf-8</code>. If you have tests that check the content type of responses, you may need to update these accordingly.</p>
<h3 id="233">2.3.3</h3>
<p><strong>Date</strong>: 16th May 2013</p>
<ul>
<li>Added SearchFilter</li>
<li>Added OrderingFilter</li>
<li>Added GenericViewSet</li>
<li>Bugfix: Multiple <code>@action</code> and <code>@link</code> methods now allowed on viewsets.</li>
<li>Bugfix: Fix API Root view issue with DjangoModelPermissions</li>
</ul>
<h3 id="232">2.3.2</h3>
<p><strong>Date</strong>: 8th May 2013</p>
<ul>
<li>Bugfix: Fix <code>TIME_FORMAT</code>, <code>DATETIME_FORMAT</code> and <code>DATE_FORMAT</code> settings.</li>
<li>Bugfix: Fix <code>DjangoFilterBackend</code> issue, failing when used on view with queryset attribute.</li>
</ul>
<h3 id="231">2.3.1</h3>
<p><strong>Date</strong>: 7th May 2013</p>
<ul>
<li>Bugfix: Fix breadcrumb rendering issue.</li>
</ul>
<h3 id="230">2.3.0</h3>
<p><strong>Date</strong>: 7th May 2013</p>
<ul>
<li>ViewSets and Routers.</li>
<li>ModelSerializers support reverse relations in 'fields' option.</li>
<li>HyperLinkedModelSerializers support 'id' field in 'fields' option.</li>
<li>Cleaner generic views.</li>
<li>Support for multiple filter classes.</li>
<li>FileUploadParser support for raw file uploads.</li>
<li>DecimalField support.</li>
<li>Made Login template easier to restyle.</li>
<li>Bugfix: Fix issue with depth&gt;1 on ModelSerializer.</li>
</ul>
<p><strong>Note</strong>: See the <a href="../2.3-announcement">2.3 announcement</a> for full details.</p>
<hr />
<h2 id="22x-series">2.2.x series</h2>
<h3 id="227">2.2.7</h3>
<p><strong>Date</strong>: 17th April 2013</p>
<ul>
<li>Loud failure when view does not return a <code>Response</code> or <code>HttpResponse</code>.</li>
<li>Bugfix: Fix for Django 1.3 compatibility.</li>
<li>Bugfix: Allow overridden <code>get_object()</code> to work correctly.</li>
</ul>
<h3 id="226">2.2.6</h3>
<p><strong>Date</strong>: 4th April 2013</p>
<ul>
<li>OAuth2 authentication no longer requires unnecessary URL parameters in addition to the token.</li>
<li>URL hyperlinking in browsable API now handles more cases correctly.</li>
<li>Long HTTP headers in browsable API are broken in multiple lines when possible.</li>
<li>Bugfix: Fix regression with DjangoFilterBackend not worthing correctly with single object views.</li>
<li>Bugfix: OAuth should fail hard when invalid token used.</li>
<li>Bugfix: Fix serializer potentially returning <code>None</code> object for models that define <code>__bool__</code> or <code>__len__</code>.</li>
</ul>
<h3 id="225">2.2.5</h3>
<p><strong>Date</strong>: 26th March 2013</p>
<ul>
<li>Serializer support for bulk create and bulk update operations.</li>
<li>Regression fix: Date and time fields return date/time objects by default. Fixes regressions caused by 2.2.2. See <a href="https://github.com/tomchristie/django-rest-framework/pull/743">#743</a> for more details.</li>
<li>Bugfix: Fix 500 error is OAuth not attempted with OAuthAuthentication class installed.</li>
<li><code>Serializer.save()</code> now supports arbitrary keyword args which are passed through to the object <code>.save()</code> method. Mixins use <code>force_insert</code> and <code>force_update</code> where appropriate, resulting in one less database query.</li>
</ul>
<h3 id="224">2.2.4</h3>
<p><strong>Date</strong>: 13th March 2013</p>
<ul>
<li>OAuth 2 support.</li>
<li>OAuth 1.0a support.</li>
<li>Support X-HTTP-Method-Override header.</li>
<li>Filtering backends are now applied to the querysets for object lookups as well as lists. (Eg you can use a filtering backend to control which objects should 404)</li>
<li>Deal with error data nicely when deserializing lists of objects.</li>
<li>Extra override hook to configure <code>DjangoModelPermissions</code> for unauthenticated users.</li>
<li>Bugfix: Fix regression which caused extra database query on paginated list views.</li>
<li>Bugfix: Fix pk relationship bug for some types of 1-to-1 relations.</li>
<li>Bugfix: Workaround for Django bug causing case where <code>Authtoken</code> could be registered for cascade delete from <code>User</code> even if not installed.</li>
</ul>
<h3 id="223">2.2.3</h3>
<p><strong>Date</strong>: 7th March 2013</p>
<ul>
<li>Bugfix: Fix None values for for <code>DateField</code>, <code>DateTimeField</code> and <code>TimeField</code>.</li>
</ul>
<h3 id="222">2.2.2</h3>
<p><strong>Date</strong>: 6th March 2013</p>
<ul>
<li>Support for custom input and output formats for <code>DateField</code>, <code>DateTimeField</code> and <code>TimeField</code>.</li>
<li>Cleanup: Request authentication is no longer lazily evaluated, instead authentication is always run, which results in more consistent, obvious behavior. Eg. Supplying bad auth credentials will now always return an error response, even if no permissions are set on the view.</li>
<li>Bugfix for serializer data being uncacheable with pickle protocol 0.</li>
<li>Bugfixes for model field validation edge-cases.</li>
<li>Bugfix for authtoken migration while using a custom user model and south.</li>
</ul>
<h3 id="221">2.2.1</h3>
<p><strong>Date</strong>: 22nd Feb 2013</p>
<ul>
<li>Security fix: Use <code>defusedxml</code> package to address XML parsing vulnerabilities.</li>
<li>Raw data tab added to browsable API. (Eg. Allow for JSON input.)</li>
<li>Added TimeField.</li>
<li>Serializer fields can be mapped to any method that takes no args, or only takes kwargs which have defaults.</li>
<li>Unicode support for view names/descriptions in browsable API.</li>
<li>Bugfix: request.DATA should return an empty <code>QueryDict</code> with no data, not <code>None</code>.</li>
<li>Bugfix: Remove unneeded field validation, which caused extra queries.</li>
</ul>
<p><strong>Security note</strong>: Following the <a href="http://blog.python.org/2013/02/announcing-defusedxml-fixes-for-xml.html">disclosure of security vulnerabilities</a> in Python's XML parsing libraries, use of the <code>XMLParser</code> class now requires the <code>defusedxml</code> package to be installed.</p>
<p>The security vulnerabilities only affect APIs which use the <code>XMLParser</code> class, by enabling it in any views, or by having it set in the <code>DEFAULT_PARSER_CLASSES</code> setting. Note that the <code>XMLParser</code> class is not enabled by default, so this change should affect a minority of users.</p>
<h3 id="220">2.2.0</h3>
<p><strong>Date</strong>: 13th Feb 2013</p>
<ul>
<li>Python 3 support.</li>
<li>Added a <code>post_save()</code> hook to the generic views.</li>
<li>Allow serializers to handle dicts as well as objects.</li>
<li>Deprecate <code>ManyRelatedField()</code> syntax in favor of <code>RelatedField(many=True)</code></li>
<li>Deprecate <code>null=True</code> on relations in favor of <code>required=False</code>.</li>
<li>Deprecate <code>blank=True</code> on CharFields, just use <code>required=False</code>.</li>
<li>Deprecate optional <code>obj</code> argument in permissions checks in favor of <code>has_object_permission</code>.</li>
<li>Deprecate implicit hyperlinked relations behavior.</li>
<li>Bugfix: Fix broken DjangoModelPermissions.</li>
<li>Bugfix: Allow serializer output to be cached.</li>
<li>Bugfix: Fix styling on browsable API login.</li>
<li>Bugfix: Fix issue with deserializing empty to-many relations.</li>
<li>Bugfix: Ensure model field validation is still applied for ModelSerializer subclasses with an custom <code>.restore_object()</code> method.</li>
</ul>
<p><strong>Note</strong>: See the <a href="../2.2-announcement">2.2 announcement</a> for full details.</p>
<hr />
<h2 id="21x-series">2.1.x series</h2>
<h3 id="2117">2.1.17</h3>
<p><strong>Date</strong>: 26th Jan 2013</p>
<ul>
<li>Support proper 401 Unauthorized responses where appropriate, instead of always using 403 Forbidden.</li>
<li>Support json encoding of timedelta objects.</li>
<li><code>format_suffix_patterns()</code> now supports <code>include</code> style URL patterns.</li>
<li>Bugfix: Fix issues with custom pagination serializers.</li>
<li>Bugfix: Nested serializers now accept <code>source='*'</code> argument.</li>
<li>Bugfix: Return proper validation errors when incorrect types supplied for relational fields.</li>
<li>Bugfix: Support nullable FKs with <code>SlugRelatedField</code>.</li>
<li>Bugfix: Don't call custom validation methods if the field has an error.</li>
</ul>
<p><strong>Note</strong>: If the primary authentication class is <code>TokenAuthentication</code> or <code>BasicAuthentication</code>, a view will now correctly return 401 responses to unauthenticated access, with an appropriate <code>WWW-Authenticate</code> header, instead of 403 responses.</p>
<h3 id="2116">2.1.16</h3>
<p><strong>Date</strong>: 14th Jan 2013</p>
<ul>
<li>Deprecate <code>django.utils.simplejson</code> in favor of Python 2.6's built-in json module.</li>
<li>Bugfix: <code>auto_now</code>, <code>auto_now_add</code> and other <code>editable=False</code> fields now default to read-only.</li>
<li>Bugfix: PK fields now only default to read-only if they are an AutoField or if <code>editable=False</code>.</li>
<li>Bugfix: Validation errors instead of exceptions when serializers receive incorrect types.</li>
<li>Bugfix: Validation errors instead of exceptions when related fields receive incorrect types.</li>
<li>Bugfix: Handle ObjectDoesNotExist exception when serializing null reverse one-to-one</li>
</ul>
<p><strong>Note</strong>: Prior to 2.1.16, The Decimals would render in JSON using floating point if <code>simplejson</code> was installed, but otherwise render using string notation. Now that use of <code>simplejson</code> has been deprecated, Decimals will consistently render using string notation. See <a href="../../ticket-582">ticket 582</a> for more details.</p>
<h3 id="2115">2.1.15</h3>
<p><strong>Date</strong>: 3rd Jan 2013</p>
<ul>
<li>Added <code>PATCH</code> support.</li>
<li>Added <code>RetrieveUpdateAPIView</code>.</li>
<li>Remove unused internal <code>save_m2m</code> flag on <code>ModelSerializer.save()</code>.</li>
<li>Tweak behavior of hyperlinked fields with an explicit format suffix.</li>
<li>Relation changes are now persisted in <code>.save()</code> instead of in <code>.restore_object()</code>.</li>
<li>Bugfix: Fix issue with FileField raising exception instead of validation error when files=None.</li>
<li>Bugfix: Partial updates should not set default values if field is not included.</li>
</ul>
<h3 id="2114">2.1.14</h3>
<p><strong>Date</strong>: 31st Dec 2012</p>
<ul>
<li>Bugfix: ModelSerializers now include reverse FK fields on creation.</li>
<li>Bugfix: Model fields with <code>blank=True</code> are now <code>required=False</code> by default.</li>
<li>Bugfix: Nested serializers now support nullable relationships.</li>
</ul>
<p><strong>Note</strong>: From 2.1.14 onwards, relational fields move out of the <code>fields.py</code> module and into the new <code>relations.py</code> module, in order to separate them from regular data type fields, such as <code>CharField</code> and <code>IntegerField</code>.</p>
<p>This change will not affect user code, so long as it's following the recommended import style of <code>from rest_framework import serializers</code> and referring to fields using the style <code>serializers.PrimaryKeyRelatedField</code>.</p>
<h3 id="2113">2.1.13</h3>
<p><strong>Date</strong>: 28th Dec 2012</p>
<ul>
<li>Support configurable <code>STATICFILES_STORAGE</code> storage.</li>
<li>Bugfix: Related fields now respect the required flag, and may be required=False.</li>
</ul>
<h3 id="2112">2.1.12</h3>
<p><strong>Date</strong>: 21st Dec 2012</p>
<ul>
<li>Bugfix: Fix bug that could occur using ChoiceField.</li>
<li>Bugfix: Fix exception in browsable API on DELETE.</li>
<li>Bugfix: Fix issue where pk was was being set to a string if set by URL kwarg.</li>
</ul>
<h3 id="2111">2.1.11</h3>
<p><strong>Date</strong>: 17th Dec 2012</p>
<ul>
<li>Bugfix: Fix issue with M2M fields in browsable API.</li>
</ul>
<h3 id="2110">2.1.10</h3>
<p><strong>Date</strong>: 17th Dec 2012</p>
<ul>
<li>Bugfix: Ensure read-only fields don't have model validation applied.</li>
<li>Bugfix: Fix hyperlinked fields in paginated results.</li>
</ul>
<h3 id="219">2.1.9</h3>
<p><strong>Date</strong>: 11th Dec 2012</p>
<ul>
<li>Bugfix: Fix broken nested serialization.</li>
<li>Bugfix: Fix <code>Meta.fields</code> only working as tuple not as list.</li>
<li>Bugfix: Edge case if unnecessarily specifying <code>required=False</code> on read only field.</li>
</ul>
<h3 id="218">2.1.8</h3>
<p><strong>Date</strong>: 8th Dec 2012</p>
<ul>
<li>Fix for creating nullable Foreign Keys with <code>''</code> as well as <code>None</code>.</li>
<li>Added <code>null=&lt;bool&gt;</code> related field option.</li>
</ul>
<h3 id="217">2.1.7</h3>
<p><strong>Date</strong>: 7th Dec 2012</p>
<ul>
<li>Serializers now properly support nullable Foreign Keys.</li>
<li>Serializer validation now includes model field validation, such as uniqueness constraints.</li>
<li>Support 'true' and 'false' string values for BooleanField.</li>
<li>Added pickle support for serialized data.</li>
<li>Support <code>source='dotted.notation'</code> style for nested serializers.</li>
<li>Make <code>Request.user</code> settable.</li>
<li>Bugfix: Fix <code>RegexField</code> to work with <code>BrowsableAPIRenderer</code>.</li>
</ul>
<h3 id="216">2.1.6</h3>
<p><strong>Date</strong>: 23rd Nov 2012</p>
<ul>
<li>Bugfix: Unfix DjangoModelPermissions. (I am a doofus.)</li>
</ul>
<h3 id="215">2.1.5</h3>
<p><strong>Date</strong>: 23rd Nov 2012</p>
<ul>
<li>Bugfix: Fix DjangoModelPermissions.</li>
</ul>
<h3 id="214">2.1.4</h3>
<p><strong>Date</strong>: 22nd Nov 2012</p>
<ul>
<li>Support for partial updates with serializers.</li>
<li>Added <code>RegexField</code>.</li>
<li>Added <code>SerializerMethodField</code>.</li>
<li>Serializer performance improvements.</li>
<li>Added <code>obtain_token_view</code> to get tokens when using <code>TokenAuthentication</code>.</li>
<li>Bugfix: Django 1.5 configurable user support for <code>TokenAuthentication</code>.</li>
</ul>
<h3 id="213">2.1.3</h3>
<p><strong>Date</strong>: 16th Nov 2012</p>
<ul>
<li>Added <code>FileField</code> and <code>ImageField</code>. For use with <code>MultiPartParser</code>.</li>
<li>Added <code>URLField</code> and <code>SlugField</code>.</li>
<li>Support for <code>read_only_fields</code> on <code>ModelSerializer</code> classes.</li>
<li>Support for clients overriding the pagination page sizes. Use the <code>PAGINATE_BY_PARAM</code> setting or set the <code>paginate_by_param</code> attribute on a generic view.</li>
<li>201 Responses now return a 'Location' header.</li>
<li>Bugfix: Serializer fields now respect <code>max_length</code>.</li>
</ul>
<h3 id="212">2.1.2</h3>
<p><strong>Date</strong>: 9th Nov 2012</p>
<ul>
<li><strong>Filtering support.</strong></li>
<li>Bugfix: Support creation of objects with reverse M2M relations.</li>
</ul>
<h3 id="211">2.1.1</h3>
<p><strong>Date</strong>: 7th Nov 2012</p>
<ul>
<li>Support use of HTML exception templates. Eg. <code>403.html</code></li>
<li>Hyperlinked fields take optional <code>slug_field</code>, <code>slug_url_kwarg</code> and <code>pk_url_kwarg</code> arguments.</li>
<li>Bugfix: Deal with optional trailing slashes properly when generating breadcrumbs.</li>
<li>Bugfix: Make textareas same width as other fields in browsable API.</li>
<li>Private API change: <code>.get_serializer</code> now uses same <code>instance</code> and <code>data</code> ordering as serializer initialization.</li>
</ul>
<h3 id="210">2.1.0</h3>
<p><strong>Date</strong>: 5th Nov 2012</p>
<ul>
<li><strong>Serializer <code>instance</code> and <code>data</code> keyword args have their position swapped.</strong></li>
<li><code>queryset</code> argument is now optional on writable model fields.</li>
<li>Hyperlinked related fields optionally take <code>slug_field</code> and <code>slug_url_kwarg</code> arguments.</li>
<li>Support Django's cache framework.</li>
<li>Minor field improvements. (Don't stringify dicts, more robust many-pk fields.)</li>
<li>Bugfix: Support choice field in Browsable API.</li>
<li>Bugfix: Related fields with <code>read_only=True</code> do not require a <code>queryset</code> argument.</li>
</ul>
<p><strong>API-incompatible changes</strong>: Please read <a href="https://groups.google.com/d/topic/django-rest-framework/Vv2M0CMY9bg/discussion">this thread</a> regarding the <code>instance</code> and <code>data</code> keyword args before updating to 2.1.0.</p>
<hr />
<h2 id="20x-series">2.0.x series</h2>
<h3 id="202">2.0.2</h3>
<p><strong>Date</strong>: 2nd Nov 2012</p>
<ul>
<li>Fix issues with pk related fields in the browsable API.</li>
</ul>
<h3 id="201">2.0.1</h3>
<p><strong>Date</strong>: 1st Nov 2012</p>
<ul>
<li>Add support for relational fields in the browsable API.</li>
<li>Added SlugRelatedField and ManySlugRelatedField.</li>
<li>If PUT creates an instance return '201 Created', instead of '200 OK'.</li>
</ul>
<h3 id="200">2.0.0</h3>
<p><strong>Date</strong>: 30th Oct 2012</p>
<ul>
<li><strong>Fix all of the things.</strong> (Well, almost.)</li>
<li>For more information please see the <a href="../rest-framework-2-announcement">2.0 announcement</a>.</li>
</ul>
<p>For older release notes, <a href="../../old-release-notes">please see the GitHub repo</a>.</p>
</div>
<!--/span-->
</div>
<!--/row-->
</div>
<!--/.fluid-container-->
</div>
<!--/.body content-->
<div id="push"></div>
</div>
<!--/.wrapper -->
<footer class="span12">
<p>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</a>
</p>
</footer>
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../../js/jquery-1.8.1-min.js"></script>
<script src="../../js/prettify-1.0.js"></script>
<script src="../../js/bootstrap-2.1.1-min.js"></script>
<script>
//$('.side-nav').scrollspy()
var shiftWindow = function() {
scrollBy(0, -50)
};
if (location.hash) shiftWindow();
window.addEventListener("hashchange", shiftWindow);
$('.dropdown-menu').on('click touchstart', function(event) {
event.stopPropagation();
});
// Dynamically force sidenav to no higher than browser window
$('.side-nav').css('max-height', window.innerHeight - 130);
$(function() {
$(window).resize(function() {
$('.side-nav').css('max-height', window.innerHeight - 130);
});
});
</script>
</body>
</html>