mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-06 05:20:12 +03:00
Tweak deprecations
This commit is contained in:
parent
903f7fd5b5
commit
d34b69d6f6
|
@ -145,9 +145,12 @@ For more information see the [Python client library documentation][py-docs].
|
||||||
|
|
||||||
## Deprecations
|
## 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
|
### DjangoFilterBackend
|
||||||
|
|
||||||
|
|
|
@ -320,9 +320,9 @@ class DefaultRouter(SimpleRouter):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
if 'schema_title' in kwargs:
|
if 'schema_title' in kwargs:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"Including a schema directly via a router is now pending "
|
"Including a schema directly via a router is now deprecated. "
|
||||||
"deprecation. Use `get_schema_view()` instead.",
|
"Use `get_schema_view()` instead.",
|
||||||
PendingDeprecationWarning
|
DeprecationWarning
|
||||||
)
|
)
|
||||||
if 'schema_renderers' in kwargs:
|
if 'schema_renderers' in kwargs:
|
||||||
assert 'schema_title' in kwargs, 'Missing "schema_title" argument.'
|
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_title = kwargs.pop('schema_title', None)
|
||||||
self.schema_url = kwargs.pop('schema_url', None)
|
self.schema_url = kwargs.pop('schema_url', None)
|
||||||
self.schema_renderers = kwargs.pop('schema_renderers', self.default_schema_renderers)
|
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:
|
if 'root_renderers' in kwargs:
|
||||||
self.root_renderers = kwargs.pop('root_renderers')
|
self.root_renderers = kwargs.pop('root_renderers')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user