Tweak deprecations

This commit is contained in:
Tom Christie 2017-03-09 14:03:49 +00:00
parent 903f7fd5b5
commit d34b69d6f6
2 changed files with 8 additions and 12 deletions

View File

@ -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

View File

@ -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')