Skip to content

Commit 67ddd54

Browse files
Merge pull request encode#3226 from tomchristie/version-3.2
Version 3.2
2 parents 37b4d42 + e3aaa32 commit 67ddd54

File tree

71 files changed

+4319
-3279
lines changed

Some content is hidden

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

71 files changed

+4319
-3279
lines changed

docs/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ General guides to using REST framework.
200200
* [Project management][project-management]
201201
* [3.0 Announcement][3.0-announcement]
202202
* [3.1 Announcement][3.1-announcement]
203+
* [3.2 Announcement][3.2-announcement]
203204
* [Kickstarter Announcement][kickstarter-announcement]
204205
* [Release Notes][release-notes]
205206

@@ -312,6 +313,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
312313
[third-party-resources]: topics/third-party-resources.md
313314
[3.0-announcement]: topics/3.0-announcement.md
314315
[3.1-announcement]: topics/3.1-announcement.md
316+
[3.2-announcement]: topics/3.2-announcement.md
315317
[kickstarter-announcement]: topics/kickstarter-announcement.md
316318
[release-notes]: topics/release-notes.md
317319

docs/topics/3.2-announcement.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Django REST framework 3.2
2+
3+
The 3.2 release is the first version to include an admin interface for the browsable API.
4+
5+
![The AdminRenderer](../img/admin.png)
6+
7+
This interface is intended to act as a more user-friendly interface to the API. It can be used either as a replacement to the existing `BrowsableAPIRenderer`, or used together with it, allowing you to switch between the two styles as required.
8+
9+
We've also fixed a huge number of issues, and made numerous cleanups and improvements.
10+
11+
Over the course of the 3.1.x series we've [resolved nearly 600 tickets](https://github.com/tomchristie/django-rest-framework/issues?utf8=%E2%9C%93&q=closed%3A%3E2015-03-05) on our GitHub issue tracker. This means we're currently running at a rate of **closing around 100 issues or pull requests per month**.
12+
13+
None of this would have been possible without the support of our wonderful Kickstarter backers. If you're looking for a job in Django development we'd strongly recommend taking [a look through our sponsors](http://www.django-rest-framework.org/topics/kickstarter-announcement/#sponsors) and finding out who's hiring.
14+
15+
## AdminRenderer
16+
17+
To include `AdminRenderer` simply add it to your settings:
18+
19+
REST_FRAMEWORK = {
20+
'DEFAULT_RENDERER_CLASSES': [
21+
'rest_framework.renderers.JSONRenderer',
22+
'rest_framework.renderers.AdminRenderer',
23+
'rest_framework.renderers.BrowsableAPIRenderer'
24+
],
25+
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
26+
'PAGE_SIZE': 100
27+
}
28+
29+
There are some limitations to the `AdminRenderer`, in particular it is not yet able to handle list or dictionary inputs, as we do not have any HTML form fields that support those.
30+
31+
Also note that this is an initial release and we do not yet have a public API for modifying the behavior or documentation on overriding the templates.
32+
33+
The idea is to get this released to users early, so we can start getting feedback and release a more fully featured version in 3.3.
34+
35+
## Deprecations
36+
37+
There are no new deprecations in 3.2, although a number of existing deprecations have now escalated in line with our deprecation policy.
38+
39+
* `request.DATA` was put on the deprecation path in 3.0. It has now been removed and its usage will result in an error. Use the more pythonic style of `request.data` instead.
40+
* `request.FILES` was put on the deprecation path in 3.0. It has now been removed and its usage will result in an error. Use the more pythonic style of `request.files` instead.
41+
* `request.QUERY_PARAMS` was put on the deprecation path in 3.0. It has now been removed and its usage will result in an error. Use the more pythonic style of `request.query_params` instead.
42+
* The following `ModelSerializer.Meta` options have now been removed: `write_only_fields`, `view_name`, `lookup_field`. Use the more general `extra_kwargs` option instead.
43+
44+
The following pagination view attributes and settings have been moved into attributes on the pagination class since 3.1. Their usage was formerly in 'pending deprecation', and has now escalated to 'deprecated'. They will continue to function but will raise errors.
45+
46+
* `view.paginate_by` - Use `paginator.page_size` instead.
47+
* `view.page_query_param` - Use `paginator.page_query_param` instead.
48+
* `view.paginate_by_param` - Use `paginator.page_size_query_param` instead.
49+
* `view.max_paginate_by` - Use `paginator.max_page_size` instead.
50+
* `settings.PAGINATE_BY` - Use `paginator.page_size` instead.
51+
* `settings.PAGINATE_BY_PARAM` - Use `paginator.page_size_query_param` instead.
52+
* `settings.MAX_PAGINATE_BY` - Use `max_page_size` instead.
53+
54+
## Modifications to list behaviors
55+
56+
There are a couple of bug fixes that are worth calling out as they introduce differing behavior.
57+
58+
These are a little subtle and probably won't affect most users, but are worth understanding before upgrading your project.
59+
60+
### ManyToMany fields and blank=True
61+
62+
We've now added an `allow_empty` argument, which can be used with `ListSerializer`, or with `many=True` relationships. This is `True` by default, but can be set to `False` if you want to disallow empty lists as valid input.
63+
64+
As a follow-up to this we are now able to properly mirror the behavior of Django's `ModelForm` with respect to how many-to-many fields are validated.
65+
66+
Previously a many-to-many field on a model would map to a serializer field that would allow either empty or non-empty list inputs. Now, a many-to-many field will map to a serializer field that requires at least one input, unless the model field has `blank=True` set.
67+
68+
Here's what the mapping looks like in practice:
69+
70+
* `models.ManyToManyField()``serializers.PrimaryKeyRelatedField(many=True, allow_empty=False)`
71+
* `models.ManyToManyField(blank=True)``serializers.PrimaryKeyRelatedField(many=True)`
72+
73+
The upshot is this: If you have many to many fields in your models, then make sure you've included the argument `blank=True` if you want to allow empty inputs in the equivalent `ModelSerializer` fields.
74+
75+
### List fields and allow_null
76+
77+
When using `allow_null` with `ListField` or a nested `mant=True` serializer the previous behavior was to allow `null` values as items in the list. The behavior is now to allow `null` values instead of the list.
78+
79+
For example, take the following field:
80+
81+
NestedSerializer(many=True, allow_null=True)
82+
83+
Previously the validation behavior would be:
84+
85+
* `[{…}, null, {…}]` is **valid**.
86+
* `null` is **invalid**.
87+
88+
Our validation behavior as of 3.2.0 is now:
89+
90+
* `[{…}, null, {…}]` is **invalid**.
91+
* `null` is **valid**.
92+
93+
If you want to allow `null` child items, you'll need to instead specify `allow_null` on the child class, using an explicit `ListField` instead of `many=True`. For example:
94+
95+
ListField(child=NestedSerializer(allow_null=True))
96+
97+
## What's next?
98+
99+
The 3.3 release is currently planned for the start of October, and will be the last Kickstarter-funded release.
100+
101+
This release is planned to include:
102+
103+
* Search and filtering controls in the browsable API and admin interface.
104+
* Improvements and public API for the admin interface.
105+
* Improvements and public API for our templated HTML forms and fields.
106+
* Nested object and list support in HTML forms.
107+
108+
Thanks once again to all our sponsors and supporters.

docs/topics/release-notes.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,44 @@ You can determine your currently installed version using `pip freeze`:
3838

3939
---
4040

41+
## 3.2.x series
42+
43+
### 3.2.0
44+
45+
**Date**: [6th August 2015][3.2.0-milestone].
46+
47+
* Add `AdminRenderer`. ([#2926][gh2926])
48+
* Add `FilePathField`. ([#1854][gh1854])
49+
* Add `allow_empty` to `ListField`. ([#2250][gh2250])
50+
* Support django-guardian 1.3. ([#3165][gh3165])
51+
* Support grouped choices. ([#3225][gh3225])
52+
* Support error forms in browsable API. ([#3024][gh3024])
53+
* Allow permission classes to customize the error message. ([#2539][gh2539])
54+
* Support `source=<method>` on hyperlinked fields. ([#2690][gh2690])
55+
* `ListField(allow_null=True)` now allows null as the list value, not null items in the list. ([#2766][gh2766])
56+
* `ManyToMany()` maps to `allow_empty=False`, `ManyToMany(blank=True)` maps to `allow_empty=True`. ([#2804][gh2804])
57+
* Support custom serialization styles for primary key fields. ([#2789][gh2789])
58+
* `OPTIONS` requests support nested representations. ([#2915][gh2915])
59+
* Set `view.action == "metadata"` for viewsets with `OPTIONS` requests. ([#3115][gh3115])
60+
* Support `allow_blank` on `UUIDField`. ([#3130][gh#3130])
61+
* Do not display view docstrings with 401 or 403 response codes. ([#3216][gh3216])
62+
* Resolve Django 1.8 deprecation warnings. ([#2886][gh2886])
63+
* Fix for `DecimalField` validation. ([#3139][gh3139])
64+
* Fix behavior of `allow_blank=False` when used with `trim_whitespace=True`. ([#2712][gh2712])
65+
* Fix issue with some field combinations incorrectly mapping to an invalid `allow_blank` argument. ([#3011][gh3011])
66+
* Fix for output representations with prefetches and modified querysets. ([#2704][gh2704], [#2727][gh2727])
67+
* Fix assertion error when CursorPagination is provided with certains invalid query parameters. (#2920)[gh2920].
68+
* Fix `UnicodeDecodeError` when invalid characters included in header with `TokenAuthentication`. ([#2928][gh2928])
69+
* Fix transaction rollbacks with `@non_atomic_requests` decorator. ([#3016][gh3016])
70+
* Fix duplicate results issue with Oracle databases using `SearchFilter`. ([#2935][gh2935])
71+
* Fix checkbox alignment and rendering in browsable API forms. ([#2783][gh2783])
72+
* Fix for unsaved file objects which should use `"url": null` in the representation. ([#2759][gh2759])
73+
* Fix field value rendering in browsable API. ([#2416][gh2416])
74+
* Fix `HStoreField` to include `allow_blank=True` in `DictField` mapping. ([#2659][gh2659])
75+
* Numerous other cleanups, improvements to error messaging, private API & minor fixes.
76+
77+
---
78+
4179
## 3.1.x series
4280

4381
### 3.1.3
@@ -225,6 +263,7 @@ For older release notes, [please see the version 2.x documentation][old-release-
225263
[3.1.1-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.1.1+Release%22
226264
[3.1.2-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.1.2+Release%22
227265
[3.1.3-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.1.3+Release%22
266+
[3.2.0-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.2.0+Release%22
228267

229268
<!-- 3.0.1 -->
230269
[gh2013]: https://github.com/tomchristie/django-rest-framework/issues/2013
@@ -382,3 +421,33 @@ For older release notes, [please see the version 2.x documentation][old-release-
382421
[gh2618]: https://github.com/tomchristie/django-rest-framework/issues/2618
383422
[gh3008]: https://github.com/tomchristie/django-rest-framework/issues/3008
384423
[gh2695]: https://github.com/tomchristie/django-rest-framework/issues/2695
424+
425+
<!-- 3.2.0 -->
426+
[gh1854]: https://github.com/tomchristie/django-rest-framework/issues/1854
427+
[gh2250]: https://github.com/tomchristie/django-rest-framework/issues/2250
428+
[gh2416]: https://github.com/tomchristie/django-rest-framework/issues/2416
429+
[gh2539]: https://github.com/tomchristie/django-rest-framework/issues/2539
430+
[gh2659]: https://github.com/tomchristie/django-rest-framework/issues/2659
431+
[gh2690]: https://github.com/tomchristie/django-rest-framework/issues/2690
432+
[gh2704]: https://github.com/tomchristie/django-rest-framework/issues/2704
433+
[gh2712]: https://github.com/tomchristie/django-rest-framework/issues/2712
434+
[gh2727]: https://github.com/tomchristie/django-rest-framework/issues/2727
435+
[gh2759]: https://github.com/tomchristie/django-rest-framework/issues/2759
436+
[gh2766]: https://github.com/tomchristie/django-rest-framework/issues/2766
437+
[gh2783]: https://github.com/tomchristie/django-rest-framework/issues/2783
438+
[gh2789]: https://github.com/tomchristie/django-rest-framework/issues/2789
439+
[gh2804]: https://github.com/tomchristie/django-rest-framework/issues/2804
440+
[gh2886]: https://github.com/tomchristie/django-rest-framework/issues/2886
441+
[gh2915]: https://github.com/tomchristie/django-rest-framework/issues/2915
442+
[gh2920]: https://github.com/tomchristie/django-rest-framework/issues/2920
443+
[gh2926]: https://github.com/tomchristie/django-rest-framework/issues/2926
444+
[gh2928]: https://github.com/tomchristie/django-rest-framework/issues/2928
445+
[gh2935]: https://github.com/tomchristie/django-rest-framework/issues/2935
446+
[gh3011]: https://github.com/tomchristie/django-rest-framework/issues/3011
447+
[gh3016]: https://github.com/tomchristie/django-rest-framework/issues/3016
448+
[gh3024]: https://github.com/tomchristie/django-rest-framework/issues/3024
449+
[gh3115]: https://github.com/tomchristie/django-rest-framework/issues/3115
450+
[gh3139]: https://github.com/tomchristie/django-rest-framework/issues/3139
451+
[gh3165]: https://github.com/tomchristie/django-rest-framework/issues/3165
452+
[gh3216]: https://github.com/tomchristie/django-rest-framework/issues/3216
453+
[gh3225]: https://github.com/tomchristie/django-rest-framework/issues/3225

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,6 @@ pages:
5555
- 'Project management': 'topics/project-management.md'
5656
- '3.0 Announcement': 'topics/3.0-announcement.md'
5757
- '3.1 Announcement': 'topics/3.1-announcement.md'
58+
- '3.2 Announcement': 'topics/3.2-announcement.md'
5859
- 'Kickstarter Announcement': 'topics/kickstarter-announcement.md'
5960
- 'Release Notes': 'topics/release-notes.md'

rest_framework/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99

1010
__title__ = 'Django REST framework'
11-
__version__ = '3.1.3'
11+
__version__ = '3.2.0'
1212
__author__ = 'Tom Christie'
1313
__license__ = 'BSD 2-Clause'
1414
__copyright__ = 'Copyright 2011-2015 Tom Christie'
13 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)