diff options
Diffstat (limited to 'docs/topics')
| -rw-r--r-- | docs/topics/3.0-announcement.md | 9 | ||||
| -rw-r--r-- | docs/topics/3.1-announcement.md | 196 | ||||
| -rw-r--r-- | docs/topics/credits.md | 404 | ||||
| -rw-r--r-- | docs/topics/internationalization.md | 113 | ||||
| -rw-r--r-- | docs/topics/kickstarter-announcement.md | 2 | ||||
| -rw-r--r-- | docs/topics/project-management.md | 60 | ||||
| -rw-r--r-- | docs/topics/release-notes.md | 662 | 
7 files changed, 455 insertions, 991 deletions
| diff --git a/docs/topics/3.0-announcement.md b/docs/topics/3.0-announcement.md index 0710766f..24e69c2d 100644 --- a/docs/topics/3.0-announcement.md +++ b/docs/topics/3.0-announcement.md @@ -87,12 +87,12 @@ The resulting API changes are further detailed below.  #### The `.create()` and `.update()` methods. -The `.restore_object()` method is now replaced with two separate methods, `.create()` and `.update()`. - -These methods also replace the optional `.save_object()` method, which no longer exists. +The `.restore_object()` method is now removed, and we instead have two separate methods, `.create()` and `.update()`. These methods work slightly different to the previous `.restore_object()`.  When using the `.create()` and `.update()` methods you should both create *and save* the object instance. This is in contrast to the previous `.restore_object()` behavior that would instantiate the object but not save it. +These methods also replace the optional `.save_object()` method, which no longer exists. +  The following example from the tutorial previously used `restore_object()` to handle both creating and updating object instances.      def restore_object(self, attrs, instance=None): @@ -665,7 +665,7 @@ This code *would be valid* in `2.4.3`:          class Meta:              model = Account -However this code *would not be valid* in `2.4.3`: +However this code *would not be valid* in `3.0`:      # Missing `queryset`      class AccountSerializer(serializers.Serializer): @@ -940,6 +940,7 @@ The default JSON renderer will return float objects for un-coerced `Decimal` ins  * The serializer `ChoiceField` does not currently display nested choices, as was the case in 2.4. This will be address as part of 3.1.  * Due to the new templated form rendering, the 'widget' option is no longer valid. This means there's no easy way of using third party "autocomplete" widgets for rendering select inputs that contain a large number of choices. You'll either need to use a regular select or a plain text input. We may consider addressing this in 3.1 or 3.2 if there's sufficient demand.  * Some of the default validation error messages were rewritten and might no longer be pre-translated. You can still [create language files with Django][django-localization] if you wish to localize them. +* `APIException` subclasses could previously take could previously take any arbitrary type in the `detail` argument. These exceptions now use translatable text strings, and as a result call `force_text` on the `detail` argument, which *must be a string*. If you need complex arguments to an `APIException` class, you should subclass it and override the `__init__()` method. Typically you'll instead want to use a custom exception handler to provide for non-standard error responses.  --- diff --git a/docs/topics/3.1-announcement.md b/docs/topics/3.1-announcement.md new file mode 100644 index 00000000..7242a032 --- /dev/null +++ b/docs/topics/3.1-announcement.md @@ -0,0 +1,196 @@ +# Django REST framework 3.1 + +The 3.1 release is an intermediate step in the Kickstarter project releases, and includes a range of new functionality. + +Some highlights include: + +* A super-smart cursor pagination scheme. +* An improved pagination API, supporting header or in-body pagination styles. +* Pagination controls rendering in the browsable API. +* Better support for API versioning. +* Built-in internalization support. +* Support for Django 1.8's `HStoreField` and `ArrayField`. + +--- + +## Pagination + +The pagination API has been improved, making it both easier to use, and more powerful. + +#### New pagination schemes. + +Until now, there has only been a single built-in pagination style in REST framework. We now have page, limit/offset and cursor based schemes included by default. + +The cursor based pagination scheme is particularly smart, and is a better approach for clients iterating through large or frequently changing result sets. The scheme supports paging against non-unique indexes, by using both cursor and limit/offset information. It also allows for both forward and reverse cursor pagination. Much credit goes to David Cramer for [this blog post](http://cramer.io/2011/03/08/building-cursors-for-the-disqus-api/) on the subject. + +#### Pagination controls in the browsable API. + +Paginated results now include controls that render directly in the browsable API. If you're using the page or limit/offset style, then you'll see a page based control displayed in the browsable API: + + + +The cursor based pagination renders a more simple style of control: + + + +#### Support for header-based pagination. + +The pagination API was previously only able to alter the pagination style in the body of the response. The API now supports being able to write pagination information in response headers, making it possible to use pagination schemes that use the `Link` or `Content-Range` headers. + +For more information, see the [custom pagination styles](../api-guide/pagination/#custom-pagination-styles) documentation. + +--- + +## Versioning + +We've made it easier to build versioned APIs. Built-in schemes for versioning include both URL based and Accept header based variations. + +When using a URL based scheme, hyperlinked serializers will resolve relationships to the same API version as used on the incoming request. + +For example, when using `NamespaceVersioning`, and the following hyperlinked serializer: + +    class AccountsSerializer(serializer.HyperlinkedModelSerializer): +        class Meta: +            model = Accounts +            fields = ('account_name', 'users') + +The output representation would match the version used on the incoming request. Like so: + +    GET http://example.org/v2/accounts/10  # Version 'v2' + +    { +        "account_name": "europa", +        "users": [ +            "http://example.org/v2/users/12",  # Version 'v2' +            "http://example.org/v2/users/54", +            "http://example.org/v2/users/87" +        ] +    } + +--- + +## Internationalization + +REST framework now includes a built-in set of translations, and supports internationalized error responses. This allows you to either change the default language, or to allow clients to specify the language via the `Accept-Language` header. + +You can change the default language by using the standard Django `LANGUAGE_CODE` setting: + +    LANGUAGE_CODE = "es-es" + +You can turn on per-request language requests by adding `LocalMiddleware` to your `MIDDLEWARE_CLASSES` setting: + +    MIDDLEWARE_CLASSES = [ +        ... +        'django.middleware.locale.LocaleMiddleware' +    ] + +When per-request internationalization is enabled, client requests will respect the `Accept-Language` header where possible. For example, let's make a request for an unsupported media type: + +**Request** + +    GET /api/users HTTP/1.1 +    Accept: application/xml +    Accept-Language: es-es +    Host: example.org + +**Response** + +    HTTP/1.0 406 NOT ACCEPTABLE + +    { +        "detail": "No se ha podido satisfacer la solicitud de cabecera de Accept." +    } + +Note that the structure of the error responses is still the same. We still have a `details` key in the response. If needed you can modify this behavior too, by using a [custom exception handler][custom-exception-handler]. + +We include built-in translations both for standard exception cases, and for serializer validation errors. + +The full list of supported languages can be found on our [Transifex project page](https://www.transifex.com/projects/p/django-rest-framework/). + +If you only wish to support a subset of the supported languages, use Django's standard `LANGUAGES` setting: + +    LANGUAGES = [ +        ('de', _('German')), +        ('en', _('English')), +    ] + +For more details, see the [internationalization documentation](internationalization.md). + +Many thanks to [Craig Blaszczyk](https://github.com/jakul) for helping push this through. + +--- + +## New field types + +Django 1.8's new `ArrayField`, `HStoreField` and `UUIDField` are now all fully supported. + +This work also means that we now have both `serializers.DictField()`, and `serializers.ListField()` types, allowing you to express and validate a wider set of representations. + +If you're building a new 1.8 project, then you should probably consider using `UUIDField` as the primary keys for all your models. This style will work automatically with hyperlinked serializers, returning URLs in the following style: + +    http://example.org/api/purchases/9b1a433f-e90d-4948-848b-300fdc26365d + +--- + +## ModelSerializer API + +The serializer redesign in 3.0 did not include any public API for modifying how ModelSerializer classes automatically generate a set of fields from a given mode class. We've now re-introduced an API for this, allowing you to create new ModelSerializer base classes that behave differently, such as using a different default style for relationships. + +For more information, see the documentation on [customizing field mappings](../api-guide/serializers/#customizing-field-mappings) for ModelSerializer classes. + +--- + +## Moving packages out of core + +We've now moved a number of packages out of the core of REST framework, and into separately installable packages. If you're currently using these you don't need to worry, you simply need to `pip install` the new packages, and change any import paths. + +We're making this change in order to help distribute the maintainance workload, and keep better focus of the core essentials of the framework. + +The change also means we can be more flexible with which external packages we recommend. For example, the excellently maintained [Django OAuth toolkit](https://github.com/evonove/django-oauth-toolkit) has now been promoted as our recommended option for integrating OAuth support. + +The following packages are now moved out of core and should be separately installed: + +* OAuth - [djangorestframework-oauth](http://jpadilla.github.io/django-rest-framework-oauth/) +* XML - [djangorestframework-xml](http://jpadilla.github.io/django-rest-framework-xml) +* YAML - [djangorestframework-yaml](http://jpadilla.github.io/django-rest-framework-yaml) +* JSONP - [djangorestframework-jsonp](http://jpadilla.github.io/django-rest-framework-jsonp) + +It's worth reiterating that this change in policy shouldn't mean any work in your codebase other than adding a new requirement and modifying some import paths. For example to install XML rendering, you would now do: + +    pip install djangorestframework-xml + +And modify your settings, like so: + +    REST_FRAMEWORK = { +        'DEFAULT_RENDERER_CLASSES': [ +            'rest_framework.renderers.JSONRenderer', +            'rest_framework.renderers.BrowsableAPIRenderer', +            'rest_framework_xml.renderers.XMLRenderer' +        ] +    } + +Thanks go to the latest member of our maintenance team, [José Padilla](https://github.com/jpadilla/), for handling this work and taking on ownership of these packages. + +--- + +## Deprecations + +The `request.DATA`, `request.FILES` and `request.QUERY_PARAMS` attributes move from pending deprecation, to deprecated. Use `request.data` and `request.query_params` instead, as discussed in the 3.0 release notes. + +The ModelSerializer Meta options for `write_only_fields`, `view_name` and `lookup_field` are also moved from pending deprecation, to deprecated. Use `extra_kwargs` instead, as discussed in the 3.0 release notes. + +All these attributes and options will still work in 3.1, but their usage will raise a warning. They will be fully removed in 3.2. + +--- + +## What's next? + +The next focus will be on HTML renderings of API output and will include: + +* HTML form rendering of serializers. +* Filtering controls built-in to the browsable API. +* An alternative admin-style interface. + +This will either be made as a single 3.2 release, or split across two separate releases, with the HTML forms and filter controls coming in 3.2, and the admin-style interface coming in a 3.3 release. + +[custom-exception-handler]: ../api-guide/exceptions.md#custom-exception-handling diff --git a/docs/topics/credits.md b/docs/topics/credits.md deleted file mode 100644 index 5f0dc752..00000000 --- a/docs/topics/credits.md +++ /dev/null @@ -1,404 +0,0 @@ -# Credits - -The following people have helped make REST framework great. - -* Tom Christie - [tomchristie] -* Marko Tibold - [markotibold] -* Paul Miller - [paulmillr] -* Sébastien Piquemal - [sebpiq] -* Carmen Wick - [cwick] -* Alex Ehlke - [aehlke] -* Alen Mujezinovic - [flashingpumpkin] -* Carles Barrobés - [txels] -* Michael Fötsch - [mfoetsch] -* David Larlet - [david] -* Andrew Straw - [astraw] -* Zeth - [zeth] -* Fernando Zunino - [fzunino] -* Jens Alm - [ulmus] -* Craig Blaszczyk - [jakul] -* Garcia Solero - [garciasolero] -* Tom Drummond - [devioustree] -* Danilo Bargen - [dbrgn] -* Andrew McCloud - [amccloud] -* Thomas Steinacher - [thomasst] -* Meurig Freeman - [meurig] -* Anthony Nemitz - [anemitz] -* Ewoud Kohl van Wijngaarden - [ekohl] -* Michael Ding - [yandy] -* Mjumbe Poe - [mjumbewu] -* Natim - [natim] -* Sebastian Żurek - [sebzur] -* Benoit C - [dzen] -* Chris Pickett - [bunchesofdonald] -* Ben Timby - [btimby] -* Michele Lazzeri - [michelelazzeri-nextage] -* Camille Harang - [mammique] -* Paul Oswald - [poswald] -* Sean C. Farley - [scfarley] -* Daniel Izquierdo - [izquierdo] -* Can Yavuz - [tschan] -* Shawn Lewis - [shawnlewis] -* Alec Perkins - [alecperkins] -* Michael Barrett - [phobologic] -* Mathieu Dhondt - [laundromat] -* Johan Charpentier - [cyberj] -* Jamie Matthews - [j4mie] -* Mattbo - [mattbo] -* Max Hurl - [maximilianhurl] -* Tomi Pajunen - [eofs] -* Rob Dobson - [rdobson] -* Daniel Vaca Araujo - [diviei] -* Madis Väin - [madisvain] -* Stephan Groß - [minddust] -* Pavel Savchenko - [asfaltboy] -* Otto Yiu - [ottoyiu] -* Jacob Magnusson - [jmagnusson] -* Osiloke Harold Emoekpere - [osiloke] -* Michael Shepanski - [mjs7231] -* Toni Michel - [tonimichel] -* Ben Konrath - [benkonrath] -* Marc Aymerich - [glic3rinu] -* Ludwig Kraatz - [ludwigkraatz] -* Rob Romano - [robromano] -* Eugene Mechanism - [mechanism] -* Jonas Liljestrand - [jonlil] -* Justin Davis - [irrelative] -* Dustin Bachrach - [dbachrach] -* Mark Shirley - [maspwr] -* Olivier Aubert - [oaubert] -* Yuri Prezument - [yprez] -* Fabian Buechler - [fabianbuechler] -* Mark Hughes - [mhsparks] -* Michael van de Waeter - [mvdwaeter] -* Reinout van Rees - [reinout] -* Michael Richards - [justanotherbody] -* Ben Roberts - [roberts81] -* Venkata Subramanian Mahalingam - [annacoder] -* George Kappel - [gkappel] -* Colin Murtaugh - [cmurtaugh] -* Simon Pantzare - [pilt] -* Szymon Teżewski - [sunscrapers] -* Joel Marcotte - [joual] -* Trey Hunner - [treyhunner] -* Roman Akinfold - [akinfold] -* Toran Billups - [toranb] -* Sébastien Béal - [sebastibe] -* Andrew Hankinson - [ahankinson] -* Juan Riaza - [juanriaza] -* Michael Mior - [michaelmior] -* Marc Tamlyn - [mjtamlyn] -* Richard Wackerbarth - [wackerbarth] -* Johannes Spielmann - [shezi] -* James Cleveland - [radiosilence] -* Steve Gregory - [steve-gregory] -* Federico Capoano - [nemesisdesign] -* Bruno Renié - [brutasse] -* Kevin Stone - [kevinastone] -* Guglielmo Celata - [guglielmo] -* Mike Tums - [mktums] -* Michael Elovskikh - [wronglink] -* Michał Jaworski - [swistakm] -* Andrea de Marco - [z4r] -* Fernando Rocha - [fernandogrd] -* Xavier Ordoquy - [xordoquy] -* Adam Wentz - [floppya] -* Andreas Pelme - [pelme] -* Ryan Detzel - [ryanrdetzel] -* Omer Katz - [thedrow] -* Wiliam Souza - [waa] -* Jonas Braun - [iekadou] -* Ian Dash - [bitmonkey] -* Bouke Haarsma - [bouke] -* Pierre Dulac - [dulaccc] -* Dave Kuhn - [kuhnza] -* Sitong Peng - [stoneg] -* Victor Shih - [vshih] -* Atle Frenvik Sveen - [atlefren] -* J Paul Reed - [preed] -* Matt Majewski - [forgingdestiny] -* Jerome Chen - [chenjyw] -* Andrew Hughes - [eyepulp] -* Daniel Hepper - [dhepper] -* Hamish Campbell - [hamishcampbell] -* Marlon Bailey - [avinash240] -* James Summerfield - [jsummerfield] -* Andy Freeland - [rouge8] -* Craig de Stigter - [craigds] -* Pablo Recio - [pyriku] -* Brian Zambrano - [brianz] -* Òscar Vilaplana - [grimborg] -* Ryan Kaskel - [ryankask] -* Andy McKay - [andymckay] -* Matteo Suppo - [matteosuppo] -* Karol Majta - [lolek09] -* David Jones - [commonorgarden] -* Andrew Tarzwell - [atarzwell] -* Michal Dvořák - [mikee2185] -* Markus Törnqvist - [mjtorn] -* Pascal Borreli - [pborreli] -* Alex Burgel - [aburgel] -* David Medina - [copitux] -* Areski Belaid - [areski] -* Ethan Freman - [mindlace] -* David Sanders - [davesque] -* Philip Douglas - [freakydug] -* Igor Kalat - [trwired] -* Rudolf Olah - [omouse] -* Gertjan Oude Lohuis - [gertjanol] -* Matthias Jacob - [cyroxx] -* Pavel Zinovkin - [pzinovkin] -* Will Kahn-Greene - [willkg] -* Kevin Brown - [kevin-brown] -* Rodrigo Martell - [coderigo] -* James Rutherford - [jimr] -* Ricky Rosario - [rlr] -* Veronica Lynn - [kolvia] -* Dan Stephenson - [etos] -* Martin Clement - [martync] -* Jeremy Satterfield - [jsatt] -* Christopher Paolini - [chrispaolini] -* Filipe A Ximenes - [filipeximenes] -* Ramiro Morales - [ramiro] -* Krzysztof Jurewicz - [krzysiekj] -* Eric Buehl - [ericbuehl] -* Kristian Øllegaard - [kristianoellegaard] -* Alexander Akhmetov - [alexander-akhmetov] -* Andrey Antukh - [niwibe] -* Mathieu Pillard - [diox] -* Edmond Wong - [edmondwong] -* Ben Reilly - [bwreilly] -* Tai Lee - [mrmachine] -* Markus Kaiserswerth - [mkai] -* Henry Clifford - [hcliff] -* Thomas Badaud - [badale] -* Colin Huang - [tamakisquare] -* Ross McFarland - [ross] -* Jacek Bzdak - [jbzdak] -* Alexander Lukanin - [alexanderlukanin13] -* Yamila Moreno - [yamila-moreno] -* Rob Hudson - [robhudson] -* Alex Good - [alexjg] -* Ian Foote - [ian-foote] -* Chuck Harmston - [chuckharmston] -* Philip Forget - [philipforget] -* Artem Mezhenin - [amezhenin] - -Many thanks to everyone who's contributed to the project. - -## Additional thanks - -The documentation is built with [Bootstrap] and [Markdown]. - -Project hosting is with [GitHub]. - -Continuous integration testing is managed with [Travis CI][travis-ci]. - -The [live sandbox][sandbox] is hosted on [Heroku]. - -Various inspiration taken from the [Rails], [Piston], [Tastypie], [Dagny] and [django-viewsets] projects. - -Development of REST framework 2.0 was sponsored by [DabApps]. - -## Contact - -For usage questions please see the [REST framework discussion group][group]. - -You can also contact [@_tomchristie][twitter] directly on twitter. - -[twitter]: http://twitter.com/_tomchristie -[bootstrap]: http://twitter.github.com/bootstrap/ -[markdown]: http://daringfireball.net/projects/markdown/ -[github]: https://github.com/tomchristie/django-rest-framework -[travis-ci]: https://secure.travis-ci.org/tomchristie/django-rest-framework -[rails]: http://rubyonrails.org/ -[piston]: https://bitbucket.org/jespern/django-piston -[tastypie]: https://github.com/toastdriven/django-tastypie -[dagny]: https://github.com/zacharyvoase/dagny -[django-viewsets]: https://github.com/BertrandBordage/django-viewsets -[dabapps]: http://lab.dabapps.com -[sandbox]: http://restframework.herokuapp.com/ -[heroku]: http://www.heroku.com/ -[group]: https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework - -[tomchristie]: https://github.com/tomchristie -[markotibold]: https://github.com/markotibold -[paulmillr]: https://github.com/paulmillr -[sebpiq]: https://github.com/sebpiq -[cwick]: https://github.com/cwick -[aehlke]: https://github.com/aehlke -[flashingpumpkin]: https://github.com/flashingpumpkin -[txels]: https://github.com/txels -[mfoetsch]: https://github.com/mfoetsch -[david]: https://github.com/david -[astraw]: https://github.com/astraw -[zeth]: https://github.com/zeth -[fzunino]: https://github.com/fzunino -[ulmus]: https://github.com/ulmus -[jakul]: https://github.com/jakul -[garciasolero]: https://github.com/garciasolero -[devioustree]: https://github.com/devioustree -[dbrgn]: https://github.com/dbrgn -[amccloud]: https://github.com/amccloud -[thomasst]: https://github.com/thomasst -[meurig]: https://github.com/meurig -[anemitz]: https://github.com/anemitz -[ekohl]: https://github.com/ekohl -[yandy]: https://github.com/yandy -[mjumbewu]: https://github.com/mjumbewu -[natim]: https://github.com/natim -[sebzur]: https://github.com/sebzur -[dzen]: https://github.com/dzen -[bunchesofdonald]: https://github.com/bunchesofdonald -[btimby]: https://github.com/btimby -[michelelazzeri-nextage]: https://github.com/michelelazzeri-nextage -[mammique]: https://github.com/mammique -[poswald]: https://github.com/poswald -[scfarley]: https://github.com/scfarley -[izquierdo]: https://github.com/izquierdo -[tschan]: https://github.com/tschan -[shawnlewis]: https://github.com/shawnlewis -[alecperkins]: https://github.com/alecperkins -[phobologic]: https://github.com/phobologic -[laundromat]: https://github.com/laundromat -[cyberj]: https://github.com/cyberj -[j4mie]: https://github.com/j4mie -[mattbo]: https://github.com/mattbo -[maximilianhurl]: https://github.com/maximilianhurl -[eofs]: https://github.com/eofs -[rdobson]: https://github.com/rdobson -[diviei]: https://github.com/diviei -[madisvain]: https://github.com/madisvain -[minddust]: https://github.com/minddust -[asfaltboy]: https://github.com/asfaltboy -[ottoyiu]: https://github.com/OttoYiu -[jmagnusson]: https://github.com/jmagnusson -[osiloke]: https://github.com/osiloke -[mjs7231]: https://github.com/mjs7231 -[tonimichel]: https://github.com/tonimichel -[benkonrath]: https://github.com/benkonrath -[glic3rinu]: https://github.com/glic3rinu -[ludwigkraatz]: https://github.com/ludwigkraatz -[robromano]: https://github.com/robromano -[mechanism]: https://github.com/mechanism -[jonlil]: https://github.com/jonlil -[irrelative]: https://github.com/irrelative -[dbachrach]: https://github.com/dbachrach -[maspwr]: https://github.com/maspwr -[oaubert]: https://github.com/oaubert -[yprez]: https://github.com/yprez -[fabianbuechler]: https://github.com/fabianbuechler -[mhsparks]: https://github.com/mhsparks -[mvdwaeter]: https://github.com/mvdwaeter -[reinout]: https://github.com/reinout -[justanotherbody]: https://github.com/justanotherbody -[roberts81]: https://github.com/roberts81 -[annacoder]: https://github.com/annacoder -[gkappel]: https://github.com/gkappel -[cmurtaugh]: https://github.com/cmurtaugh -[pilt]: https://github.com/pilt -[sunscrapers]: https://github.com/sunscrapers -[joual]: https://github.com/joual -[treyhunner]: https://github.com/treyhunner -[akinfold]: https://github.com/akinfold -[toranb]: https://github.com/toranb -[sebastibe]: https://github.com/sebastibe -[ahankinson]: https://github.com/ahankinson -[juanriaza]: https://github.com/juanriaza -[michaelmior]: https://github.com/michaelmior -[mjtamlyn]: https://github.com/mjtamlyn -[wackerbarth]: https://github.com/wackerbarth -[shezi]: https://github.com/shezi -[radiosilence]: https://github.com/radiosilence -[steve-gregory]: https://github.com/steve-gregory -[nemesisdesign]: https://github.com/nemesisdesign -[brutasse]: https://github.com/brutasse -[kevinastone]: https://github.com/kevinastone -[guglielmo]: https://github.com/guglielmo -[mktums]: https://github.com/mktums -[wronglink]: https://github.com/wronglink -[swistakm]: https://github.com/swistakm -[z4r]: https://github.com/z4r -[fernandogrd]: https://github.com/fernandogrd -[xordoquy]: https://github.com/xordoquy -[floppya]: https://github.com/floppya -[pelme]: https://github.com/pelme -[ryanrdetzel]: https://github.com/ryanrdetzel -[thedrow]: https://github.com/thedrow -[waa]: https://github.com/wiliamsouza -[iekadou]: https://github.com/iekadou -[bitmonkey]: https://github.com/bitmonkey -[bouke]: https://github.com/bouke -[dulaccc]: https://github.com/dulaccc -[kuhnza]: https://github.com/kuhnza -[stoneg]: https://github.com/stoneg -[vshih]: https://github.com/vshih -[atlefren]: https://github.com/atlefren -[preed]: https://github.com/preed -[forgingdestiny]: https://github.com/forgingdestiny -[chenjyw]: https://github.com/chenjyw -[eyepulp]: https://github.com/eyepulp -[dhepper]: https://github.com/dhepper -[hamishcampbell]: https://github.com/hamishcampbell -[avinash240]: https://github.com/avinash240 -[jsummerfield]: https://github.com/jsummerfield -[rouge8]: https://github.com/rouge8 -[craigds]: https://github.com/craigds -[pyriku]: https://github.com/pyriku -[brianz]: https://github.com/brianz -[grimborg]: https://github.com/grimborg -[ryankask]: https://github.com/ryankask -[andymckay]: https://github.com/andymckay -[matteosuppo]: https://github.com/matteosuppo -[lolek09]: https://github.com/lolek09 -[commonorgarden]: https://github.com/commonorgarden -[atarzwell]: https://github.com/atarzwell -[mikee2185]: https://github.com/mikee2185 -[mjtorn]: https://github.com/mjtorn -[pborreli]: https://github.com/pborreli -[aburgel]: https://github.com/aburgel -[copitux]: https://github.com/copitux -[areski]: https://github.com/areski -[mindlace]: https://github.com/mindlace -[davesque]: https://github.com/davesque -[freakydug]: https://github.com/freakydug -[trwired]: https://github.com/trwired -[omouse]: https://github.com/omouse -[gertjanol]: https://github.com/gertjanol -[cyroxx]: https://github.com/cyroxx -[pzinovkin]: https://github.com/pzinovkin -[coderigo]: https://github.com/coderigo -[willkg]: https://github.com/willkg -[kevin-brown]: https://github.com/kevin-brown -[jimr]: https://github.com/jimr -[rlr]: https://github.com/rlr -[kolvia]: https://github.com/kolvia -[etos]: https://github.com/etos -[martync]: https://github.com/martync -[jsatt]: https://github.com/jsatt -[chrispaolini]: https://github.com/chrispaolini -[filipeximenes]: https://github.com/filipeximenes -[ramiro]: https://github.com/ramiro -[krzysiekj]: https://github.com/krzysiekj -[ericbuehl]: https://github.com/ericbuehl -[kristianoellegaard]: https://github.com/kristianoellegaard -[alexander-akhmetov]: https://github.com/alexander-akhmetov -[niwibe]: https://github.com/niwibe -[diox]: https://github.com/diox -[edmondwong]: https://github.com/edmondwong -[bwreilly]: https://github.com/bwreilly -[mrmachine]: https://github.com/mrmachine -[mkai]: https://github.com/mkai -[hcliff]: https://github.com/hcliff -[badale]: https://github.com/badale -[tamakisquare]: https://github.com/tamakisquare -[ross]: https://github.com/ross -[jbzdak]: https://github.com/jbzdak -[alexanderlukanin13]: https://github.com/alexanderlukanin13 -[yamila-moreno]: https://github.com/yamila-moreno -[robhudson]: https://github.com/robhudson -[alexjg]: https://github.com/alexjg -[ian-foote]: https://github.com/ian-foote -[chuckharmston]: https://github.com/chuckharmston -[philipforget]: https://github.com/philipforget -[amezhenin]: https://github.com/amezhenin diff --git a/docs/topics/internationalization.md b/docs/topics/internationalization.md new file mode 100644 index 00000000..3968e23d --- /dev/null +++ b/docs/topics/internationalization.md @@ -0,0 +1,113 @@ +# Internationalization + +> Supporting internationalization is not optional. It must be a core feature. +> +> — [Jannis Leidel, speaking at Django Under the Hood, 2015][cite]. + +REST framework ships with translatable error messages. You can make these appear in your language enabling [Django's standard translation mechanisms][django-translation]. + +Doing so will allow you to: + +* Select a language other than English as the default, using the standard `LANGUAGE_CODE` Django setting. +* Allow clients to choose a language themselves, using the `LocaleMiddleware` included with Django. A typical usage for API clients would be to include an `Accept-Language` request header. + +## Enabling internationalized APIs + +You can change the default language by using the standard Django `LANGUAGE_CODE` setting: + +    LANGUAGE_CODE = "es-es" + +You can turn on per-request language requests by adding `LocalMiddleware` to your `MIDDLEWARE_CLASSES` setting: + +    MIDDLEWARE_CLASSES = [ +        ... +        'django.middleware.locale.LocaleMiddleware' +    ] + +When per-request internationalization is enabled, client requests will respect the `Accept-Language` header where possible. For example, let's make a request for an unsupported media type: + +**Request** + +    GET /api/users HTTP/1.1 +    Accept: application/xml +    Accept-Language: es-es +    Host: example.org + +**Response** + +    HTTP/1.0 406 NOT ACCEPTABLE + +    {"detail": "No se ha podido satisfacer la solicitud de cabecera de Accept."} + +REST framework includes these built-in translations both for standard exception cases, and for serializer validation errors. + +Note that the translations only apply to the error strings themselves. The format of error messages, and the keys of field names will remain the same. An example `400 Bad Request` response body might look like this: + +    {"detail": {"username": ["Esse campo deve ser unico."]}} + +If you want to use different string for parts of the response such as `detail` and `non_field_errors` then you can modify this behavior by using a [custom exception handler][custom-exception-handler]. + +#### Specifying the set of supported languages. + +By default all available languages will be supported. + +If you only wish to support a subset of the available languages, use Django's standard `LANGUAGES` setting: + +    LANGUAGES = [ +        ('de', _('German')), +        ('en', _('English')), +    ] + +## Adding new translations + +REST framework translations are managed online using [Transifex][transifex-project]. You can use the Transifex service to add new translation languages. The maintenance team will then ensure that these translation strings are included in the REST framework package. + +Sometimes you may need to add translation strings to your project locally. You may need to do this if: + +* You want to use REST Framework in a language which has not been translated yet on Transifex. +* Your project includes custom error messages, which are not part of REST framework's default translation strings. + +#### Translating a new language locally + +This guide assumes you are already familiar with how to translate a Django app.  If you're not, start by reading [Django's translation docs][django-translation]. + +If you're translating a new language you'll need to translate the existing REST framework error messages: + +1. Make a new folder where you want to store the internationalization resources. Add this path to your [`LOCALE_PATHS`][django-locale-paths] setting. + +2. Now create a subfolder for the language you want to translate. The folder should be named using [locale name][django-locale-name] notation. For example: `de`, `pt_BR`, `es_AR`. + +3. Now copy the [base translations file][django-po-source] from the REST framework source code into your translations folder. + +4. Edit the `django.po` file you've just copied, translating all the error messages. + +5. Run `manage.py compilemessages -l pt_BR` to make the translations  +available for Django to use. You should see a message like `processing file django.po in <...>/locale/pt_BR/LC_MESSAGES`. + +6. Restart your development server to see the changes take effect. + +If you're only translating custom error messages that exist inside your project codebase you don't need to copy the REST framework source `django.po` file into a `LOCALE_PATHS` folder, and can instead simply run Django's standard `makemessages` process. + +## How the language is determined + +If you want to allow per-request language preferences you'll need to include `django.middleware.locale.LocaleMiddleware` in your `MIDDLEWARE_CLASSES` setting. + +You can find more information on how the language preference is determined in the [Django documentation][django-language-preference]. For reference, the method is: + +1. First, it looks for the language prefix in the requested URL. +2. Failing that, it looks for the `LANGUAGE_SESSION_KEY` key in the current user’s session. +3. Failing that, it looks for a cookie. +4. Failing that, it looks at the `Accept-Language` HTTP header. +5. Failing that, it uses the global `LANGUAGE_CODE` setting. + +For API clients the most appropriate of these will typically be to use the `Accept-Language` header; Sessions and cookies will not be available unless using session authentication, and generally better practice to prefer an `Accept-Language` header for API clients rather than using language URL prefixes. + +[cite]: http://youtu.be/Wa0VfS2q94Y +[django-translation]: https://docs.djangoproject.com/en/1.7/topics/i18n/translation +[custom-exception-handler]: ../api-guide/exceptions.md#custom-exception-handling
 +[transifex-project]: https://www.transifex.com/projects/p/django-rest-framework/ +[django-po-source]: https://raw.githubusercontent.com/tomchristie/django-rest-framework/master/rest_framework/locale/en_US/LC_MESSAGES/django.po  +[django-language-preference]: https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#how-django-discovers-language-preference +[django-locale-paths]: https://docs.djangoproject.com/en/1.7/ref/settings/#std:setting-LOCALE_PATHS +[django-locale-name]: https://docs.djangoproject.com/en/1.7/topics/i18n/#term-locale-name +[contributing]: ../../CONTRIBUTING.md diff --git a/docs/topics/kickstarter-announcement.md b/docs/topics/kickstarter-announcement.md index 9f99e3e6..78c5cce6 100644 --- a/docs/topics/kickstarter-announcement.md +++ b/docs/topics/kickstarter-announcement.md @@ -84,7 +84,7 @@ Our gold sponsors include companies large and small. Many thanks for their signi  <li><a href="http://pulsecode.ca" rel="nofollow" style="background-image:url(../../img/sponsors/2-pulsecode.png);">Pulsecode Inc.</a></li>  <li><a href="http://singinghorsestudio.com" rel="nofollow" style="background-image:url(../../img/sponsors/2-singing-horse.png);">Singing Horse Studio Ltd.</a></li>  <li><a href="https://www.heroku.com/" rel="nofollow" style="background-image:url(../../img/sponsors/2-heroku.png);">Heroku</a></li> -<li><a href="https://www.galileo-press.de/" rel="nofollow" style="background-image:url(../../img/sponsors/2-galileo_press.png);">Galileo Press</a></li> +<li><a href="https://www.rheinwerk-verlag.de/" rel="nofollow" style="background-image:url(../../img/sponsors/2-rheinwerk_verlag.png);">Rheinwerk Verlag</a></li>  <li><a href="http://www.securitycompass.com/" rel="nofollow" style="background-image:url(../../img/sponsors/2-security_compass.png);">Security Compass</a></li>  <li><a href="https://www.djangoproject.com/foundation/" rel="nofollow" style="background-image:url(../../img/sponsors/2-django.png);">Django Software Foundation</a></li>  <li><a href="http://www.hipflaskapp.com" rel="nofollow" style="background-image:url(../../img/sponsors/2-hipflask.png);">Hipflask</a></li> diff --git a/docs/topics/project-management.md b/docs/topics/project-management.md index f581cabd..2a54fb94 100644 --- a/docs/topics/project-management.md +++ b/docs/topics/project-management.md @@ -58,15 +58,18 @@ The following template should be used for the description of the issue, and serv      #### New members.      If you wish to be considered for this or a future date, please comment against this or subsequent issues. +     +    To modify this process for future maintenance cycles make a pull request to the [project management](http://www.django-rest-framework.org/topics/project-management/) documentation.  #### Responsibilities of team members  Team members have the following responsibilities. -* Add triage labels and milestones to tickets.  * Close invalid or resolved tickets. +* Add triage labels and milestones to tickets.  * Merge finalized pull requests.  * Build and deploy the documentation, using `mkdocs gh-deploy`. +* Build and update the included translation packs.  Further notes for maintainers: @@ -107,11 +110,62 @@ The following template should be used for the description of the issue, and serv      - [ ] Make a release announcement on the [discussion group](https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework).      - [ ] Make a release announcement on twitter.      - [ ] Close the milestone on GitHub. +     +    To modify this process for future releases make a pull request to the [project management](http://www.django-rest-framework.org/topics/project-management/) documentation.  When pushing the release to PyPI ensure that your environment has been installed from our development `requirement.txt`, so that documentation and PyPI installs are consistently being built against a pinned set of packages.  --- +## Translations + +The maintenance team are responsible for managing the translation packs include in REST framework. Translating the source strings into multiple languages is managed through the [transifex service][transifex-project]. + +### Managing Transifex + +The [official Transifex client][transifex-client] is used to upload and download translations to Transifex. The client is installed using pip: + +    pip install transifex-client + +To use it you'll need a login to Transifex which has a password, and you'll need to have administrative access to the Transifex project. You'll need to create a `~/.transifexrc` file which contains your credentials. + +    [https://www.transifex.com] +    username = *** +    token = *** +    password = *** +    hostname = https://www.transifex.com + +### Upload new source files + +When any user visible strings are changed, they should be uploaded to Transifex so that the translators can start to translate them. To do this, just run: + +    # 1. Update the source django.po file, which is the US English version. +    cd rest_framework +    django-admin.py makemessages -l en_US +    # 2. Push the source django.po file to Transifex. +    cd .. +    tx push -s + +When pushing source files, Transifex will update the source strings of a resource to match those from the new source file. + +Here's how differences between the old and new source files will be handled: + +* New strings will be added. +* Modified strings will be added as well. +* Strings which do not exist in the new source file will be removed from the database, along with their translations. If that source strings gets re-added later then [Transifex Translation Memory][translation-memory] will automatically include the translation string. + +### Download translations + +When a translator has finished translating their work needs to be downloaded from Transifex into the REST framework repository. To do this, run: + +    # 3. Pull the translated django.po files from Transifex. +    tx pull -a +    cd rest_framework +    # 4. Compile the binary .mo files for all supported languages. +    django-admin.py compilemessages + +--- +  ## Project ownership  The PyPI package is owned by `@tomchristie`. As a backup `@j4mie` also has ownership of the package. @@ -126,9 +180,13 @@ The following issues still need to be addressed:  * Ensure `@jamie` has back-up access to the `django-rest-framework.org` domain setup and admin.  * Document ownership of the [live example][sandbox] API.  * Document ownership of the [mailing list][mailing-list] and IRC channel. +* Document ownership and management of the security mailing list.  [bus-factor]: http://en.wikipedia.org/wiki/Bus_factor  [un-triaged]: https://github.com/tomchristie/django-rest-framework/issues?q=is%3Aopen+no%3Alabel +[transifex-project]: https://www.transifex.com/projects/p/django-rest-framework/ +[transifex-client]: https://pypi.python.org/pypi/transifex-client +[translation-memory]: http://docs.transifex.com/guides/tm#let-tm-automatically-populate-translations  [github-org]: https://github.com/tomchristie/django-rest-framework/issues/2162  [sandbox]: http://restframework.herokuapp.com/  [mailing-list]: https://groups.google.com/forum/#!forum/django-rest-framework diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index b9216e36..88732df8 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -40,6 +40,45 @@ You can determine your currently installed version using `pip freeze`:  ## 3.0.x series + +### 3.0.4 + +**Date**: [28th January 2015][3.0.4-milestone]. + +* Django 1.8a1 support. ([#2425][gh2425], [#2446][gh2446], [#2441][gh2441]) +* Add `DictField` and support Django 1.8 `HStoreField`. ([#2451][gh2451], [#2106][gh2106]) +* Add `UUIDField` and support Django 1.8 `UUIDField`. ([#2448][gh2448], [#2433][gh2433], [#2432][gh2432]) +* `BaseRenderer.render` now raises `NotImplementedError`. ([#2434][gh2434]) +* Fix timedelta JSON serialization on Python 2.6. ([#2430][gh2430]) +* `ResultDict` and `ResultList` now appear as standard dict/list. ([#2421][gh2421]) +* Fix visible `HiddenField` in the HTML form of the web browsable API page. ([#2410][gh2410]) +* Use `OrderedDict` for `RelatedField.choices`. ([#2408][gh2408]) +* Fix ident format when using `HTTP_X_FORWARDED_FOR`. ([#2401][gh2401]) +* Fix invalid key with memcached while using throttling. ([#2400][gh2400]) +* Fix `FileUploadParser` with version 3.x. ([#2399][gh2399]) +* Fix the serializer inheritance. ([#2388][gh2388]) +* Fix caching issues with `ReturnDict`. ([#2360][gh2360]) + +### 3.0.3 + +**Date**: [8th January 2015][3.0.3-milestone]. + +* Fix `MinValueValidator` on `models.DateField`. ([#2369][gh2369]) +* Fix serializer missing context when pagination is used. ([#2355][gh2355]) +* Namespaced router URLs are now supported by the `DefaultRouter`. ([#2351][gh2351]) +* `required=False` allows omission of value for output. ([#2342][gh2342]) +* Use textarea input for `models.TextField`. ([#2340][gh2340]) +* Use custom `ListSerializer` for pagination if required. ([#2331][gh2331], [#2327][gh2327]) +* Better behavior with null and '' for blank HTML fields. ([#2330][gh2330]) +* Ensure fields in `exclude` are model fields. ([#2319][gh2319]) +* Fix `IntegerField` and `max_length` argument incompatibility. ([#2317][gh2317]) +* Fix the YAML encoder for 3.0 serializers. ([#2315][gh2315], [#2283][gh2283]) +* Fix the behavior of empty HTML fields. ([#2311][gh2311], [#1101][gh1101]) +* Fix Metaclass attribute depth ignoring fields attribute. ([#2287][gh2287]) +* Fix `format_suffix_patterns` to work with Django's `i18n_patterns`. ([#2278][gh2278]) +* Ability to customize router URLs for custom actions, using `url_path`. ([#2010][gh2010]) +* Don't install Django REST Framework as egg. ([#2386][gh2386]) +  ### 3.0.2  **Date**: [17th December 2014][3.0.2-milestone]. @@ -85,601 +124,24 @@ For full details see the [3.0 release announcement](3.0-announcement.md).  --- -## 2.4.x series - -### 2.4.4 - -**Date**: [3rd November 2014](https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%222.4.4+Release%22+). - -* **Security fix**: Escape URLs when replacing `format=` query parameter, as used in dropdown on `GET` button in browsable API to allow explicit selection of JSON vs HTML output. -* Maintain ordering of URLs in API root view for `DefaultRouter`. -* Fix `follow=True` in `APIRequestFactory` -* Resolve issue with invalid `read_only=True`, `required=True` fields being automatically generated by `ModelSerializer` in some cases. -* Resolve issue with `OPTIONS` requests returning incorrect information for views using `get_serializer_class` to dynamically determine serializer based on request method.  - -### 2.4.3 - -**Date**: [19th September 2014](https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%222.4.3+Release%22+). - -* Support translatable view docstrings being displayed in the browsable API. -* Support [encoded `filename*`][rfc-6266] in raw file uploads with `FileUploadParser`. -* Allow routers to support viewsets that don't include any list routes or that don't include any detail routes. -* Don't render an empty login control in browsable API if `login` view is not included. -* CSRF exemption performed in `.as_view()` to prevent accidental omission if overriding `.dispatch()`. -* Login on browsable API now displays validation errors. -* Bugfix: Fix migration in `authtoken` application. -* Bugfix: Allow selection of integer keys in nested choices. -* Bugfix: Return `None` instead of `'None'` in `CharField` with `allow_none=True`. -* Bugfix: Ensure custom model fields map to equivelent serializer fields more reliably. -* Bugfix: `DjangoFilterBackend` no longer quietly changes queryset ordering. - -### 2.4.2 - -**Date**: [3rd September 2014](https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%222.4.2+Release%22+). - -* Bugfix: Fix broken pagination for 2.4.x series. - -### 2.4.1 - -**Date**: [1st September 2014](https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%222.4.1+Release%22+). - -* Bugfix: Fix broken login template for browsable API. - -### 2.4.0 - -**Date**: [29th August 2014](https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%222.4.0+Release%22+). - -**Django version requirements**: The lowest supported version of Django is now 1.4.2. - -**South version requirements**: This note applies to any users using the optional `authtoken` application, which includes an associated database migration. You must now *either* upgrade your `south` package to version 1.0, *or* instead use the built-in migration support available with Django 1.7. - -* Added compatibility with Django 1.7's database migration support. -* New test runner, using `py.test`. -* Deprecated `.model` view attribute in favor of explicit `.queryset` and `.serializer_class` attributes. The `DEFAULT_MODEL_SERIALIZER_CLASS` setting is also deprecated. -* `@detail_route` and `@list_route` decorators replace `@action` and `@link`. -* Support customizable view name and description functions, using the `VIEW_NAME_FUNCTION` and `VIEW_DESCRIPTION_FUNCTION` settings. -* Added `NUM_PROXIES` setting for smarter client IP identification. -* Added `MAX_PAGINATE_BY` setting and `max_paginate_by` generic view attribute. -* Added `Retry-After` header to throttled responses, as per [RFC 6585](http://tools.ietf.org/html/rfc6585). This should now be used in preference to the custom `X-Trottle-Wait-Seconds` header which will be fully deprecated in 3.0. -* Added `cache` attribute to throttles to allow overriding of default cache. -* Added `lookup_value_regex` attribute to routers, to allow the URL argument matching to be constrainted by the user. -* Added `allow_none` option to `CharField`. -* Support Django's standard `status_code` class attribute on responses. -* More intuitive behavior on the test client, as `client.logout()` now also removes any credentials that have been set. -* Bugfix: `?page_size=0` query parameter now falls back to default page size for view, instead of always turning pagination off. -* Bugfix: Always uppercase `X-Http-Method-Override` methods. -* Bugfix: Copy `filter_backends` list before returning it, in order to prevent view code from mutating the class attribute itself. -* Bugfix: Set the `.action` attribute on viewsets when introspected by `OPTIONS` for testing permissions on the view. -* Bugfix: Ensure `ValueError` raised during deserialization results in a error list rather than a single error. This is now consistent with other validation errors. -* Bugfix: Fix `cache_format` typo on throttle classes, was `"throtte_%(scope)s_%(ident)s"`. Note that this will invalidate existing throttle caches. - ---- - -## 2.3.x series - -### 2.3.14 - -**Date**: 12th June 2014 - -* **Security fix**: Escape request path when it is include as part of the login and logout links in the browsable API. -* `help_text` and `verbose_name` automatically set for related fields on `ModelSerializer`. -* Fix nested serializers linked through a backward foreign key relation. -* Fix bad links for the `BrowsableAPIRenderer` with `YAMLRenderer`. -* Add `UnicodeYAMLRenderer` that extends `YAMLRenderer` with unicode. -* Fix `parse_header` argument convertion. -* Fix mediatype detection under Python 3. -* Web browsable API now offers blank option on dropdown when the field is not required. -* `APIException` representation improved for logging purposes. -* Allow source="*" within nested serializers. -* Better support for custom oauth2 provider backends. -* Fix field validation if it's optional and has no value. -* Add `SEARCH_PARAM` and `ORDERING_PARAM`. -* Fix `APIRequestFactory` to support arguments within the url string for GET. -* Allow three transport modes for access tokens when accessing a protected resource. -* Fix `QueryDict` encoding on request objects. -* Ensure throttle keys do not contain spaces, as those are invalid if using `memcached`. -* Support `blank_display_value` on `ChoiceField`. - -### 2.3.13 - -**Date**: 6th March 2014 - -* Django 1.7 Support. -* Fix `default` argument when used with serializer relation fields. -* Display the media type of the content that is being displayed in the browsable API, rather than 'text/html'. -* Bugfix for `urlize` template failure when URL regex is matched, but value does not `urlparse`. -* Use `urandom` for token generation. -* Only use `Vary: Accept` when more than one renderer exists. - -### 2.3.12 - -**Date**: 15th January 2014 - -* **Security fix**: `OrderingField` now only allows ordering on readable serializer fields, or on fields explicitly specified using `ordering_fields`. 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. -* Bugfix: `write_only = True` fields now display in the browsable API. - -### 2.3.11 - -**Date**: 14th January 2014 - -* Added `write_only` serializer field argument. -* Added `write_only_fields` option to `ModelSerializer` classes. -* JSON renderer now deals with objects that implement a dict-like interface. -* Fix compatiblity with newer versions of `django-oauth-plus`. -* Bugfix: Refine behavior that calls model manager `all()` across nested serializer relationships, preventing erronous behavior with some non-ORM objects, and preventing unnecessary queryset re-evaluations. -* Bugfix: Allow defaults on BooleanFields to be properly honored when values are not supplied. -* Bugfix: Prevent double-escaping of non-latin1 URL query params when appending `format=json` params. - -### 2.3.10 - -**Date**: 6th December 2013 - -* Add in choices information for ChoiceFields in response to `OPTIONS` requests. -* Added `pre_delete()` and `post_delete()` method hooks. -* Added status code category helper functions. -* Bugfix: Partial updates which erronously set a related field to `None` now correctly fail validation instead of raising an exception. -* Bugfix: Responses without any content no longer include an HTTP `'Content-Type'` header. -* Bugfix: Correctly handle validation errors in PUT-as-create case, responding with 400. - -### 2.3.9 - -**Date**: 15th November 2013 - -* Fix Django 1.6 exception API compatibility issue caused by `ValidationError`. -* Include errors in HTML forms in browsable API. -* Added JSON renderer support for numpy scalars. -* Added `transform_<fieldname>` hooks on serializers for easily modifying field output. -* Added `get_context` hook in `BrowsableAPIRenderer`. -* Allow serializers to be passed `files` but no `data`. -* `HTMLFormRenderer` now renders serializers directly to HTML without needing to create an intermediate form object. -* Added `get_filter_backends` hook. -* Added queryset aggregates to allowed fields in `OrderingFilter`. -* Bugfix: Fix decimal suppoprt with `YAMLRenderer`. -* Bugfix: Fix submission of unicode in browsable API through raw data form. - -### 2.3.8 - -**Date**: 11th September 2013 - -* Added `DjangoObjectPermissions`, and `DjangoObjectPermissionsFilter`. -* Support customizable exception handling, using the `EXCEPTION_HANDLER` setting. -* Support customizable view name and description functions, using the `VIEW_NAME_FUNCTION` and `VIEW_DESCRIPTION_FUNCTION` settings. -* Added `MAX_PAGINATE_BY` setting and `max_paginate_by` generic view attribute. -* Added `cache` attribute to throttles to allow overriding of default cache. -* 'Raw data' tab in browsable API now contains pre-populated data. -* 'Raw data' and 'HTML form' tab preference in browsable API now saved between page views. -* Bugfix: `required=True` argument fixed for boolean serializer fields. -* Bugfix: `client.force_authenticate(None)` should also clear session info if it exists. -* Bugfix: Client sending empty string instead of file now clears `FileField`. -* Bugfix: Empty values on ChoiceFields with `required=False` now consistently return `None`. -* Bugfix: Clients setting `page_size=0` now simply returns the default page size, instead of disabling pagination. [*] - ---- - -[*] Note that the change in `page_size=0` 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. - -    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) - ---- - -### 2.3.7 - -**Date**: 16th August 2013 - -* Added `APITestClient`, `APIRequestFactory` and `APITestCase` etc... -* Refactor `SessionAuthentication` to allow esier override for CSRF exemption. -* Remove 'Hold down "Control" message from help_text' widget messaging when not appropriate. -* Added admin configuration for auth tokens. -* Bugfix: `AnonRateThrottle` fixed to not throttle authenticated users. -* Bugfix: Don't set `X-Throttle-Wait-Seconds` when throttle does not have `wait` value. -* Bugfix: Fixed `PATCH` button title in browsable API. -* Bugfix: Fix issue with OAuth2 provider naive datetimes. - -### 2.3.6 - -**Date**: 27th June 2013 - -* Added `trailing_slash` option to routers. -* Include support for `HttpStreamingResponse`. -* Support wider range of default serializer validation when used with custom model fields. -* UTF-8 Support for browsable API descriptions. -* OAuth2 provider uses timezone aware datetimes when supported. -* Bugfix: Return error correctly when OAuth non-existent consumer occurs. -* Bugfix: Allow `FileUploadParser` to correctly filename if provided as URL kwarg. -* Bugfix: Fix `ScopedRateThrottle`. - -### 2.3.5 - -**Date**: 3rd June 2013 - -* Added `get_url` hook to `HyperlinkedIdentityField`. -* Serializer field `default` argument may be a callable. -* `@action` decorator now accepts a `methods` argument. -* Bugfix: `request.user` should be still be accessible in renderer context if authentication fails. -* Bugfix: The `lookup_field` option on `HyperlinkedIdentityField` should apply by default to the url field on the serializer. -* Bugfix: `HyperlinkedIdentityField` should continue to support `pk_url_kwarg`, `slug_url_kwarg`, `slug_field`, in a pending deprecation state. -* Bugfix: Ensure we always return 404 instead of 500 if a lookup field cannot be converted to the correct lookup type.  (Eg non-numeric `AutoInteger` pk lookup) - -### 2.3.4 - -**Date**: 24th May 2013 - -* Serializer fields now support `label` and `help_text`. -* Added `UnicodeJSONRenderer`. -* `OPTIONS` requests now return metadata about fields for `POST` and `PUT` requests. -* Bugfix: `charset` now properly included in `Content-Type` of responses. -* Bugfix: Blank choice now added in browsable API on nullable relationships. -* Bugfix: Many to many relationships with `through` tables are now read-only. -* Bugfix: Serializer fields now respect model field args such as `max_length`. -* Bugfix: SlugField now performs slug validation. -* Bugfix: Lazy-translatable strings now properly serialized. -* Bugfix: Browsable API now supports bootswatch styles properly. -* Bugfix: HyperlinkedIdentityField now uses `lookup_field` kwarg. - -**Note**: Responses now correctly include an appropriate charset on the `Content-Type` header.  For example: `application/json; charset=utf-8`.  If you have tests that check the content type of responses, you may need to update these accordingly. - -### 2.3.3 - -**Date**: 16th May 2013 - -* Added SearchFilter -* Added OrderingFilter -* Added GenericViewSet -* Bugfix: Multiple `@action` and `@link` methods now allowed on viewsets. -* Bugfix: Fix API Root view issue with DjangoModelPermissions - -### 2.3.2 - -**Date**: 8th May 2013 - -* Bugfix: Fix `TIME_FORMAT`, `DATETIME_FORMAT` and `DATE_FORMAT` settings. -* Bugfix: Fix `DjangoFilterBackend` issue, failing when used on view with queryset attribute. - -### 2.3.1 - -**Date**: 7th May 2013 - -* Bugfix: Fix breadcrumb rendering issue. - -### 2.3.0 - -**Date**: 7th May 2013 - -* ViewSets and Routers. -* ModelSerializers support reverse relations in 'fields' option. -* HyperLinkedModelSerializers support 'id' field in 'fields' option. -* Cleaner generic views. -* Support for multiple filter classes. -* FileUploadParser support for raw file uploads. -* DecimalField support. -* Made Login template easier to restyle. -* Bugfix: Fix issue with depth>1 on ModelSerializer. - -**Note**: See the [2.3 announcement][2.3-announcement] for full details. - ---- - -## 2.2.x series - -### 2.2.7 - -**Date**: 17th April 2013 - -* Loud failure when view does not return a `Response` or `HttpResponse`. -* Bugfix: Fix for Django 1.3 compatibility. -* Bugfix: Allow overridden `get_object()` to work correctly. - -### 2.2.6 - -**Date**: 4th April 2013 - -* OAuth2 authentication no longer requires unnecessary URL parameters in addition to the token. -* URL hyperlinking in browsable API now handles more cases correctly. -* Long HTTP headers in browsable API are broken in multiple lines when possible. -* Bugfix: Fix regression with DjangoFilterBackend not worthing correctly with single object views. -* Bugfix: OAuth should fail hard when invalid token used. -* Bugfix: Fix serializer potentially returning `None` object for models that define `__bool__` or `__len__`. - -### 2.2.5 - -**Date**: 26th March 2013 - -* Serializer support for bulk create and bulk update operations. -* Regression fix: Date and time fields return date/time objects by default.  Fixes regressions caused by 2.2.2.  See [#743][743] for more details. -* Bugfix: Fix 500 error is OAuth not attempted with OAuthAuthentication class installed. -* `Serializer.save()` now supports arbitrary keyword args which are passed through to the object `.save()` method.  Mixins use `force_insert` and `force_update` where appropriate, resulting in one less database query. - -### 2.2.4 - -**Date**: 13th March 2013 - -* OAuth 2 support. -* OAuth 1.0a support. -* Support X-HTTP-Method-Override header. -* 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) -* Deal with error data nicely when deserializing lists of objects. -* Extra override hook to configure `DjangoModelPermissions` for unauthenticated users. -* Bugfix: Fix regression which caused extra database query on paginated list views. -* Bugfix: Fix pk relationship bug for some types of 1-to-1 relations. -* Bugfix: Workaround for Django bug causing case where `Authtoken` could be registered for cascade delete from `User` even if not installed. - -### 2.2.3 - -**Date**: 7th March 2013 - -* Bugfix: Fix None values for for `DateField`, `DateTimeField` and `TimeField`. - -### 2.2.2 - -**Date**: 6th March 2013 - -* Support for custom input and output formats for `DateField`, `DateTimeField` and `TimeField`. -* 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. -* Bugfix for serializer data being uncacheable with pickle protocol 0. -* Bugfixes for model field validation edge-cases. -* Bugfix for authtoken migration while using a custom user model and south. - -### 2.2.1 - -**Date**: 22nd Feb 2013 - -* Security fix: Use `defusedxml` package to address XML parsing vulnerabilities. -* Raw data tab added to browsable API.  (Eg. Allow for JSON input.) -* Added TimeField. -* Serializer fields can be mapped to any method that takes no args, or only takes kwargs which have defaults. -* Unicode support for view names/descriptions in browsable API. -* Bugfix: request.DATA should return an empty `QueryDict` with no data, not `None`. -* Bugfix: Remove unneeded field validation, which caused extra queries. - -**Security note**: Following the [disclosure of security vulnerabilities][defusedxml-announce] in Python's XML parsing libraries, use of the `XMLParser` class now requires the `defusedxml` package to be installed. - -The security vulnerabilities only affect APIs which use the `XMLParser` class, by enabling it in any views, or by having it set in the `DEFAULT_PARSER_CLASSES` setting.  Note that the `XMLParser` class is not enabled by default, so this change should affect a minority of users. - -### 2.2.0 - -**Date**: 13th Feb 2013 - -* Python 3 support. -* Added a `post_save()` hook to the generic views. -* Allow serializers to handle dicts as well as objects. -* Deprecate `ManyRelatedField()` syntax in favor of `RelatedField(many=True)` -* Deprecate `null=True` on relations in favor of `required=False`. -* Deprecate `blank=True` on CharFields, just use `required=False`. -* Deprecate optional `obj` argument in permissions checks in favor of `has_object_permission`. -* Deprecate implicit hyperlinked relations behavior. -* Bugfix: Fix broken DjangoModelPermissions. -* Bugfix: Allow serializer output to be cached. -* Bugfix: Fix styling on browsable API login. -* Bugfix: Fix issue with deserializing empty to-many relations. -* Bugfix: Ensure model field validation is still applied for ModelSerializer subclasses with an custom `.restore_object()` method. - -**Note**: See the [2.2 announcement][2.2-announcement] for full details. - ---- - -## 2.1.x series - -### 2.1.17 - -**Date**: 26th Jan 2013 - -* Support proper 401 Unauthorized responses where appropriate, instead of always using 403 Forbidden. -* Support json encoding of timedelta objects. -* `format_suffix_patterns()` now supports `include` style URL patterns. -* Bugfix: Fix issues with custom pagination serializers. -* Bugfix: Nested serializers now accept `source='*'` argument. -* Bugfix: Return proper validation errors when incorrect types supplied for relational fields. -* Bugfix: Support nullable FKs with `SlugRelatedField`. -* Bugfix: Don't call custom validation methods if the field has an error. - -**Note**: If the primary authentication class is `TokenAuthentication` or `BasicAuthentication`, a view will now correctly return 401 responses to unauthenticated access, with an appropriate `WWW-Authenticate` header, instead of 403 responses. - -### 2.1.16 - -**Date**: 14th Jan 2013 - -* Deprecate `django.utils.simplejson` in favor of Python 2.6's built-in json module. -* Bugfix: `auto_now`, `auto_now_add` and other `editable=False` fields now default to read-only. -* Bugfix: PK fields now only default to read-only if they are an AutoField or if `editable=False`. -* Bugfix: Validation errors instead of exceptions when serializers receive incorrect types. -* Bugfix: Validation errors instead of exceptions when related fields receive incorrect types. -* Bugfix: Handle ObjectDoesNotExist exception when serializing null reverse one-to-one - -**Note**: Prior to 2.1.16, The Decimals would render in JSON using floating point if `simplejson` was installed, but otherwise render using string notation.  Now that use of `simplejson` has been deprecated, Decimals will consistently render using string notation.  See [ticket 582](ticket-582) for more details. - -### 2.1.15 - -**Date**: 3rd Jan 2013 - -* Added `PATCH` support. -* Added `RetrieveUpdateAPIView`. -* Remove unused internal `save_m2m` flag on `ModelSerializer.save()`. -* Tweak behavior of hyperlinked fields with an explicit format suffix. -* Relation changes are now persisted in `.save()` instead of in `.restore_object()`. -* Bugfix: Fix issue with FileField raising exception instead of validation error when files=None. -* Bugfix: Partial updates should not set default values if field is not included. - -### 2.1.14 - -**Date**: 31st Dec 2012 - -* Bugfix: ModelSerializers now include reverse FK fields on creation. -* Bugfix: Model fields with `blank=True` are now `required=False` by default. -* Bugfix: Nested serializers now support nullable relationships. - -**Note**: From 2.1.14 onwards, relational fields move out of the `fields.py` module and into the new `relations.py` module, in order to separate them from regular data type fields, such as `CharField` and `IntegerField`. - -This change will not affect user code, so long as it's following the recommended import style of `from rest_framework import serializers` and referring to fields using the style `serializers.PrimaryKeyRelatedField`. - - -### 2.1.13 - -**Date**: 28th Dec 2012 - -* Support configurable `STATICFILES_STORAGE` storage. -* Bugfix: Related fields now respect the required flag, and may be required=False. - -### 2.1.12 - -**Date**: 21st Dec 2012 - -* Bugfix: Fix bug that could occur using ChoiceField. -* Bugfix: Fix exception in browsable API on DELETE. -* Bugfix: Fix issue where pk was was being set to a string if set by URL kwarg. - -### 2.1.11 - -**Date**: 17th Dec 2012 - -* Bugfix: Fix issue with M2M fields in browsable API. - -### 2.1.10 - -**Date**: 17th Dec 2012 - -* Bugfix: Ensure read-only fields don't have model validation applied. -* Bugfix: Fix hyperlinked fields in paginated results. - -### 2.1.9 - -**Date**: 11th Dec 2012 - -* Bugfix: Fix broken nested serialization. -* Bugfix: Fix `Meta.fields` only working as tuple not as list. -* Bugfix: Edge case if unnecessarily specifying `required=False` on read only field. - -### 2.1.8 - -**Date**: 8th Dec 2012 - -* Fix for creating nullable Foreign Keys with `''` as well as `None`. -* Added `null=<bool>` related field option. - -### 2.1.7 - -**Date**: 7th Dec 2012 - -* Serializers now properly support nullable Foreign Keys. -* Serializer validation now includes model field validation, such as uniqueness constraints. -* Support 'true' and 'false' string values for BooleanField. -* Added pickle support for serialized data. -* Support `source='dotted.notation'` style for nested serializers. -* Make `Request.user` settable. -* Bugfix: Fix `RegexField` to work with `BrowsableAPIRenderer`. - -### 2.1.6 - -**Date**: 23rd Nov 2012 - -* Bugfix: Unfix DjangoModelPermissions.  (I am a doofus.) - -### 2.1.5 - -**Date**: 23rd Nov 2012 - -* Bugfix: Fix DjangoModelPermissions. - -### 2.1.4 - -**Date**: 22nd Nov 2012 - -* Support for partial updates with serializers. -* Added `RegexField`. -* Added `SerializerMethodField`. -* Serializer performance improvements. -* Added `obtain_token_view` to get tokens when using `TokenAuthentication`. -* Bugfix: Django 1.5 configurable user support for `TokenAuthentication`. - -### 2.1.3 - -**Date**: 16th Nov 2012 - -* Added `FileField` and `ImageField`.  For use with `MultiPartParser`. -* Added `URLField` and `SlugField`. -* Support for `read_only_fields` on `ModelSerializer` classes. -* Support for clients overriding the pagination page sizes.  Use the `PAGINATE_BY_PARAM` setting or set the `paginate_by_param` attribute on a generic view. -* 201 Responses now return a 'Location' header. -* Bugfix: Serializer fields now respect `max_length`. - -### 2.1.2 - -**Date**: 9th Nov 2012 - -* **Filtering support.** -* Bugfix: Support creation of objects with reverse M2M relations. - -### 2.1.1 - -**Date**: 7th Nov 2012 - -* Support use of HTML exception templates.  Eg. `403.html` -* Hyperlinked fields take optional `slug_field`, `slug_url_kwarg` and `pk_url_kwarg` arguments. -* Bugfix: Deal with optional trailing slashes properly when generating breadcrumbs. -* Bugfix: Make textareas same width as other fields in browsable API. -* Private API change: `.get_serializer` now uses same `instance` and `data` ordering as serializer initialization. - -### 2.1.0 - -**Date**: 5th Nov 2012 - -* **Serializer `instance` and `data` keyword args have their position swapped.** -* `queryset` argument is now optional on writable model fields. -* Hyperlinked related fields optionally take `slug_field` and `slug_url_kwarg` arguments. -* Support Django's cache framework. -* Minor field improvements. (Don't stringify dicts, more robust many-pk fields.) -* Bugfix: Support choice field in Browsable API. -* Bugfix: Related fields with `read_only=True` do not require a `queryset` argument. - -**API-incompatible changes**: Please read [this thread][2.1.0-notes] regarding the `instance` and `data` keyword args before updating to 2.1.0. - ---- - -## 2.0.x series - -### 2.0.2 - -**Date**: 2nd Nov 2012 - -* Fix issues with pk related fields in the browsable API. - -### 2.0.1 - -**Date**: 1st Nov 2012 - -* Add support for relational fields in the browsable API. -* Added SlugRelatedField and ManySlugRelatedField. -* If PUT creates an instance return '201 Created', instead of '200 OK'. - -### 2.0.0 - -**Date**: 30th Oct 2012 - -* **Fix all of the things.**  (Well, almost.) -* For more information please see the [2.0 announcement][announcement]. - -For older release notes, [please see the GitHub repo](old-release-notes). +For older release notes, [please see the version 2.x documentation](old-release-notes).  [cite]: http://www.catb.org/~esr/writings/cathedral-bazaar/cathedral-bazaar/ar01s04.html  [deprecation-policy]: #deprecation-policy  [django-deprecation-policy]: https://docs.djangoproject.com/en/dev/internals/release-process/#internal-release-deprecation-policy  [defusedxml-announce]: http://blog.python.org/2013/02/announcing-defusedxml-fixes-for-xml.html -[2.2-announcement]: 2.2-announcement.md -[2.3-announcement]: 2.3-announcement.md  [743]: https://github.com/tomchristie/django-rest-framework/pull/743  [staticfiles14]: https://docs.djangoproject.com/en/1.4/howto/static-files/#with-a-template-tag  [staticfiles13]: https://docs.djangoproject.com/en/1.3/howto/static-files/#with-a-template-tag  [2.1.0-notes]: https://groups.google.com/d/topic/django-rest-framework/Vv2M0CMY9bg/discussion -[announcement]: rest-framework-2-announcement.md  [ticket-582]: https://github.com/tomchristie/django-rest-framework/issues/582  [rfc-6266]: http://tools.ietf.org/html/rfc6266#section-4.3 -[old-release-notes]: https://github.com/tomchristie/django-rest-framework/blob/2.4.4/docs/topics/release-notes.md#04x-series +[old-release-notes]: http://tomchristie.github.io/rest-framework-2-docs/topics/release-notes#24x-series  [3.0.1-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.0.1+Release%22  [3.0.2-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.0.2+Release%22 +[3.0.3-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.0.3+Release%22 +[3.0.4-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.0.4+Release%22  <!-- 3.0.1 -->  [gh2013]: https://github.com/tomchristie/django-rest-framework/issues/2013 @@ -729,3 +191,41 @@ For older release notes, [please see the GitHub repo](old-release-notes).  [gh2290]: https://github.com/tomchristie/django-rest-framework/issues/2290  [gh2291]: https://github.com/tomchristie/django-rest-framework/issues/2291  [gh2294]: https://github.com/tomchristie/django-rest-framework/issues/2294 +<!-- 3.0.3 --> +[gh1101]: https://github.com/tomchristie/django-rest-framework/issues/1101 +[gh2010]: https://github.com/tomchristie/django-rest-framework/issues/2010 +[gh2278]: https://github.com/tomchristie/django-rest-framework/issues/2278 +[gh2283]: https://github.com/tomchristie/django-rest-framework/issues/2283 +[gh2287]: https://github.com/tomchristie/django-rest-framework/issues/2287 +[gh2311]: https://github.com/tomchristie/django-rest-framework/issues/2311 +[gh2315]: https://github.com/tomchristie/django-rest-framework/issues/2315 +[gh2317]: https://github.com/tomchristie/django-rest-framework/issues/2317 +[gh2319]: https://github.com/tomchristie/django-rest-framework/issues/2319 +[gh2327]: https://github.com/tomchristie/django-rest-framework/issues/2327 +[gh2330]: https://github.com/tomchristie/django-rest-framework/issues/2330 +[gh2331]: https://github.com/tomchristie/django-rest-framework/issues/2331 +[gh2340]: https://github.com/tomchristie/django-rest-framework/issues/2340 +[gh2342]: https://github.com/tomchristie/django-rest-framework/issues/2342 +[gh2351]: https://github.com/tomchristie/django-rest-framework/issues/2351 +[gh2355]: https://github.com/tomchristie/django-rest-framework/issues/2355 +[gh2369]: https://github.com/tomchristie/django-rest-framework/issues/2369 +[gh2386]: https://github.com/tomchristie/django-rest-framework/issues/2386 +<!-- 3.0.4 --> +[gh2425]: https://github.com/tomchristie/django-rest-framework/issues/2425 +[gh2446]: https://github.com/tomchristie/django-rest-framework/issues/2446 +[gh2441]: https://github.com/tomchristie/django-rest-framework/issues/2441 +[gh2451]: https://github.com/tomchristie/django-rest-framework/issues/2451 +[gh2106]: https://github.com/tomchristie/django-rest-framework/issues/2106 +[gh2448]: https://github.com/tomchristie/django-rest-framework/issues/2448 +[gh2433]: https://github.com/tomchristie/django-rest-framework/issues/2433 +[gh2432]: https://github.com/tomchristie/django-rest-framework/issues/2432 +[gh2434]: https://github.com/tomchristie/django-rest-framework/issues/2434 +[gh2430]: https://github.com/tomchristie/django-rest-framework/issues/2430 +[gh2421]: https://github.com/tomchristie/django-rest-framework/issues/2421 +[gh2410]: https://github.com/tomchristie/django-rest-framework/issues/2410 +[gh2408]: https://github.com/tomchristie/django-rest-framework/issues/2408 +[gh2401]: https://github.com/tomchristie/django-rest-framework/issues/2401 +[gh2400]: https://github.com/tomchristie/django-rest-framework/issues/2400 +[gh2399]: https://github.com/tomchristie/django-rest-framework/issues/2399 +[gh2388]: https://github.com/tomchristie/django-rest-framework/issues/2388 +[gh2360]: https://github.com/tomchristie/django-rest-framework/issues/2360 | 
