Debian Codegraph @

docs/community/3.4-announcement.md

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 <style>
2 .promo li a {
3 float: left;
4 width: 130px;
5 height: 20px;
6 text-align: center;
7 margin: 10px 30px;
8 padding: 150px 0 0 0;
9 background-position: 0 50%;
10 background-size: 130px auto;
11 background-repeat: no-repeat;
12 font-size: 120%;
13 color: black;
14 }
15 .promo li {
16 list-style: none;
17 }
18 </style>
19
20 # Django REST framework 3.4
21
22 The 3.4 release is the first in a planned series that will be addressing schema
23 generation, hypermedia support, API clients, and finally realtime support.
24
25 ---
26
27 ## Funding
28
29 The 3.4 release has been made possible a recent [Mozilla grant][moss], and by our
30 [collaborative funding model][funding]. If you use REST framework commercially, and would
31 like to see this work continue, we strongly encourage you to invest in its
32 continued development by **[signing up for a paid plan][funding]**.
33
34 The initial aim is to provide a single full-time position on REST framework.
35 Right now we're over 60% of the way towards achieving that.
36 *Every single sign-up makes a significant impact.*
37
38 <ul class="premium-promo promo">
39 <li><a href="https://www.rover.com/careers/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)">Rover.com</a></li>
40 <li><a href="https://sentry.io/welcome/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)">Sentry</a></li>
41 <li><a href="https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/stream-130.png)">Stream</a></li>
42 </ul>
43 <div style="clear: both; padding-bottom: 20px;"></div>
44
45 *Many thanks to all our [awesome sponsors][sponsors], and in particular to our premium backers, [Rover](https://www.rover.com/careers/), [Sentry](https://sentry.io/welcome/), and [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf).*
46
47 ---
48
49 ## Schemas & client libraries
50
51 REST framework 3.4 brings built-in support for generating API schemas.
52
53 We provide this support by using [Core API][core-api], a Document Object Model
54 for describing APIs.
55
56 Because Core API represents the API schema in an format-independent
57 manner, we're able to render the Core API `Document` object into many different
58 schema formats, by allowing the renderer class to determine how the internal
59 representation maps onto the external schema format.
60
61 This approach should also open the door to a range of auto-generated API
62 documentation options in the future, by rendering the `Document` object into
63 HTML documentation pages.
64
65 Alongside the built-in schema support, we're also now providing the following:
66
67 * A [command line tool][command-line-client] for interacting with APIs.
68 * A [Python client library][client-library] for interacting with APIs.
69
70 These API clients are dynamically driven, and able to interact with any API
71 that exposes a supported schema format.
72
73 Dynamically driven clients allow you to interact with an API at an application
74 layer interface, rather than a network layer interface, while still providing
75 the benefits of RESTful Web API design.
76
77 We're expecting to expand the range of languages that we provide client libraries
78 for over the coming months.
79
80 Further work on maturing the API schema support is also planned, including
81 documentation on supporting file upload and download, and improved support for
82 documentation generation and parameter annotation.
83
84 ---
85
86 Current support for schema formats is as follows:
87
88 Name | Support | PyPI package
89 ---------------------------------|-------------------------------------|--------------------------------
90 [Core JSON][core-json] | Schema generation & client support. | Built-in support in `coreapi`.
91 [Swagger / OpenAPI][swagger] | Schema generation & client support. | The `openapi-codec` package.
92 [JSON Hyper-Schema][hyperschema] | Currently client support only. | The `hyperschema-codec` package.
93 [API Blueprint][api-blueprint] | Not yet available. | Not yet available.
94
95 ---
96
97 You can read more about any of this new functionality in the following:
98
99 * New tutorial section on [schemas & client libraries][tut-7].
100 * Documentation page on [schema generation][schema-generation].
101 * Topic page on [API clients][api-clients].
102
103 It is also worth noting that Marc Gibbons is currently working towards a 2.0 release of
104 the popular Django REST Swagger package, which will tie in with our new built-in support.
105
106 ---
107
108 ## Supported versions
109
110 The 3.4.0 release adds support for Django 1.10.
111
112 The following versions of Python and Django are now supported:
113
114 * Django versions 1.8, 1.9, and 1.10.
115 * Python versions 2.7, 3.2(\*), 3.3(\*), 3.4, 3.5.
116
117 (\*) Note that Python 3.2 and 3.3 are not supported from Django 1.9 onwards.
118
119 ---
120
121 ## Deprecations and changes
122
123 The 3.4 release includes very limited deprecation or behavioral changes, and
124 should present a straightforward upgrade.
125
126 ### Use fields or exclude on serializer classes.
127
128 The following change in 3.3.0 is now escalated from "pending deprecation" to
129 "deprecated". Its usage will continue to function but will raise warnings:
130
131 `ModelSerializer` and `HyperlinkedModelSerializer` should include either a `fields`
132 option, or an `exclude` option. The `fields = '__all__'` shortcut may be used
133 to explicitly include all fields.
134
135 ### Microsecond precision when returning time or datetime.
136
137 Using the default JSON renderer and directly returning a `datetime` or `time`
138 instance will now render with microsecond precision (6 digits), rather than
139 millisecond precision (3 digits). This makes the output format consistent with the
140 default string output of `serializers.DateTimeField` and `serializers.TimeField`.
141
142 This change *does not affect the default behavior when using serializers*,
143 which is to serialize `datetime` and `time` instances into strings with
144 microsecond precision.
145
146 The serializer behavior can be modified if needed, using the `DATETIME_FORMAT`
147 and `TIME_FORMAT` settings.
148
149 The renderer behavior can be modified by setting a custom `encoder_class`
150 attribute on a `JSONRenderer` subclass.
151
152 ### Relational choices no longer displayed in OPTIONS requests.
153
154 Making an `OPTIONS` request to views that have a serializer choice field
155 will result in a list of the available choices being returned in the response.
156
157 In cases where there is a relational field, the previous behavior would be
158 to return a list of available instances to choose from for that relational field.
159
160 In order to minimize exposed information the behavior now is to *not* return
161 choices information for relational fields.
162
163 If you want to override this new behavior you'll need to [implement a custom
164 metadata class][metadata].
165
166 See [issue #3751][gh3751] for more information on this behavioral change.
167
168 ---
169
170 ## Other improvements
171
172 This release includes further work from a huge number of [pull requests and issues][milestone].
173
174 Many thanks to all our contributors who've been involved in the release, either through raising issues, giving feedback, improving the documentation, or suggesting and implementing code changes.
175
176 The full set of itemized release notes [are available here][release-notes].
177
178 [sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors
179 [moss]: mozilla-grant.md
180 [funding]: https://opencollective.com/django-rest-framework
181 [core-api]: https://www.coreapi.org/
182 [command-line-client]: https://github.com/encode/django-rest-framework/blob/3.4.7/docs/topics/api-clients.md#command-line-client
183 [client-library]: https://github.com/encode/django-rest-framework/blob/3.4.7/docs/topics/api-clients.md#python-client-library
184 [core-json]: https://www.coreapi.org/specification/encoding/#core-json-encoding
185 [swagger]: https://openapis.org/specification
186 [hyperschema]: https://json-schema.org/latest/json-schema-hypermedia.html
187 [api-blueprint]: https://apiblueprint.org/
188 [tut-7]: https://github.com/encode/django-rest-framework/blob/3.4.7/docs/tutorial/7-schemas-and-client-libraries.md
189 [schema-generation]: ../api-guide/schemas.md
190 [api-clients]: https://github.com/encode/django-rest-framework/blob/3.14.0/docs/topics/api-clients.md
191 [milestone]: https://github.com/encode/django-rest-framework/milestone/35
192 [release-notes]: ./release-notes.md#34x-series
193 [metadata]: ../api-guide/metadata.md#custom-metadata-classes
194 [gh3751]: https://github.com/encode/django-rest-framework/issues/3751