Skip to content

Commit 2e7100d

Browse files
committed
Add missing decorator: versioning_class
Mirrors encode/django-rest-framework#9719
1 parent 697ebf0 commit 2e7100d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

adrf/decorators.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ def decorator(func):
2222
# WrappedAPIView.__doc__ = func.doc <--- Not possible to do this
2323

2424
# api_view applied without (method_names)
25-
assert not (
26-
isinstance(http_method_names, types.FunctionType)
27-
), "@api_view missing list of allowed HTTP methods"
25+
assert not (isinstance(http_method_names, types.FunctionType)), (
26+
"@api_view missing list of allowed HTTP methods"
27+
)
2828

2929
# api_view applied with eg. string instead of list of strings
3030
assert isinstance(http_method_names, (list, tuple)), (
@@ -75,6 +75,10 @@ def handler(self, *args, **kwargs):
7575
func, "permission_classes", APIView.permission_classes
7676
)
7777

78+
WrappedAPIView.versioning_class = getattr(
79+
func, "versioning_class", APIView.versioning_class
80+
)
81+
7882
WrappedAPIView.schema = getattr(func, "schema", APIView.schema)
7983

8084
return WrappedAPIView.as_view()

0 commit comments

Comments
 (0)