Use stacklevel=2 with exclude_from_schema DeprecationWarning

This commit is contained in:
Daniel Hahler 2018-10-08 15:34:42 +02:00
parent 6522d4ae20
commit ff916f02bc

View File

@ -81,7 +81,7 @@ def api_view(http_method_names=None, exclude_from_schema=False):
warnings.warn(
"The `exclude_from_schema` argument to `api_view` is deprecated. "
"Use the `schema` decorator instead, passing `None`.",
DeprecationWarning
DeprecationWarning, stacklevel=2
)
WrappedAPIView.exclude_from_schema = exclude_from_schema