mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-03 05:04:31 +03:00
Use stacklevel=2 with DeprecationWarnings
This makes the warnings refer to the code where it is used, which makes it easier to find and fix.
This commit is contained in:
parent
3c420cfad5
commit
515fe928d5
|
@ -48,7 +48,7 @@ if django_filters:
|
|||
warnings.warn(
|
||||
"The built in 'rest_framework.filters.FilterSet' is deprecated. "
|
||||
"You should use 'django_filters.rest_framework.FilterSet' instead.",
|
||||
DeprecationWarning
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
return super(FilterSet, self).__init__(*args, **kwargs)
|
||||
|
||||
|
@ -72,7 +72,7 @@ class DjangoFilterBackend(DFBase):
|
|||
warnings.warn(
|
||||
"The built in 'rest_framework.filters.DjangoFilterBackend' is deprecated. "
|
||||
"You should use 'django_filters.rest_framework.DjangoFilterBackend' instead.",
|
||||
DeprecationWarning
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
|
||||
return super(DjangoFilterBackend, cls).__new__(cls, *args, **kwargs)
|
||||
|
|
|
@ -333,7 +333,7 @@ class DefaultRouter(SimpleRouter):
|
|||
warnings.warn(
|
||||
"Including a schema directly via a router is now deprecated. "
|
||||
"Use `get_schema_view()` instead.",
|
||||
DeprecationWarning
|
||||
DeprecationWarning, stacklevel=2
|
||||
)
|
||||
if 'schema_renderers' in kwargs:
|
||||
assert 'schema_title' in kwargs, 'Missing "schema_title" argument.'
|
||||
|
|
Loading…
Reference in New Issue
Block a user