From d34b69d6f6088be1d1f04b2bf4f94a5b40a2d486 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 9 Mar 2017 14:03:49 +0000 Subject: [PATCH] Tweak deprecations --- docs/topics/3.6-announcement.md | 7 +++++-- rest_framework/routers.py | 13 +++---------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/docs/topics/3.6-announcement.md b/docs/topics/3.6-announcement.md index a97c41472..43e87eda2 100644 --- a/docs/topics/3.6-announcement.md +++ b/docs/topics/3.6-announcement.md @@ -145,9 +145,12 @@ For more information see the [Python client library documentation][py-docs]. ## Deprecations -### DefaultRouter schema arguments +### Generating schemas from Router -**TODO** +The 3.5 "pending deprecation" of router arguments for generating a schema view, such as `schema_title`, `schema_url` and `schema_renderers`, have now been escalated to a +"deprecated" warning. + +Instead of using DefaultRouter(schema_title='Example API'), you should use the get_schema_view() function, and include the view explicitly in your URL conf. ### DjangoFilterBackend diff --git a/rest_framework/routers.py b/rest_framework/routers.py index bdb1ab5aa..3d2649727 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -320,9 +320,9 @@ class DefaultRouter(SimpleRouter): def __init__(self, *args, **kwargs): if 'schema_title' in kwargs: warnings.warn( - "Including a schema directly via a router is now pending " - "deprecation. Use `get_schema_view()` instead.", - PendingDeprecationWarning + "Including a schema directly via a router is now deprecated. " + "Use `get_schema_view()` instead.", + DeprecationWarning ) if 'schema_renderers' in kwargs: assert 'schema_title' in kwargs, 'Missing "schema_title" argument.' @@ -331,13 +331,6 @@ class DefaultRouter(SimpleRouter): self.schema_title = kwargs.pop('schema_title', None) self.schema_url = kwargs.pop('schema_url', None) self.schema_renderers = kwargs.pop('schema_renderers', self.default_schema_renderers) - if self.default_schema_renderers: - warnings.warn( - "The 'DefaultRouter.default_schema_renderers' is pending " - "deprecation. You should override " - "'DefaultRouter.APISchemaView' instead.", - PendingDeprecationWarning - ) if 'root_renderers' in kwargs: self.root_renderers = kwargs.pop('root_renderers')