django-rest-framework/docs/community/3.9-announcement.md

3.5 KiB

Django REST framework 3.9

The 3.9 release gives access to extra actions in the Browsable API, introduces composable permissions and built-in OpenAPI schema support.


Funding

If you use REST framework commercially and would like to see this work continue, we strongly encourage you to invest in its continued development by signing up for a paid plan.

TODO: UPDATE SPONSORS.

We'd like to say thanks in particular our premium backers, Rover, Sentry, Stream, Machinalis, and Rollbar.


ViewSet Extra Actions available in the Browsable API

Following the introduction of the action decorator in v3.8, extra actions defined on a ViewSet are now available from the Browsable API.

Extra Actions displayed in the Browsable API

When defined, a dropdown of "Extra Actions", appropriately filtered to detail/non-detail actions, is displayed.

In-built OpenAPI schema support

TODO


Deprecations

DjangoObjectPermissionsFilter moved to third-party package.

The DjangoObjectPermissionsFilter class is pending deprecation, will be deprecated in 3.10 and removed entirely in 3.11.

It has been moved to the third-party djangorestframework-guardian package. Please use this instead.

Router argument/method renamed to use basename for consistency.

  • The Router.register base_name argument has been renamed in favor of basename.
  • The Router.get_default_base_name method has been renamed in favor of Router.get_default_basename. #5990

See #5990.

base_name and get_default_base_name() are pending deprecation. They will be deprecated in 3.10 and removed entirely in 3.11.

action decorator replaces list_route and detail_route

Both list_route and detail_route are now deprecated in favour of the single action decorator. They will be removed entirely in 3.10.

The action decorator takes a boolean detail argument.

  • Replace detail_route uses with @action(detail=True).
  • Replace list_route uses with @action(detail=False).

exclude_from_schema

Both APIView.exclude_from_schema and the exclude_from_schema argument to the @api_view have now been removed.

For APIView you should instead set a schema = None attribute on the view class.

For function based views the @schema decorator can be used to exclude the view from the schema, by using @schema(None).


Minor fixes and improvements

There are a large number of minor fixes and improvements in this release. See the release notes page for a complete listing.

What's next

TODO...