allow passing custom APIView class api_view decorators

This commit is contained in:
Kamal Bin Mustafa 2013-10-03 10:34:23 +08:00
parent c3175900bc
commit b385f446dc

View File

@ -12,7 +12,7 @@ from rest_framework.views import APIView
import types import types
def api_view(http_method_names): def api_view(http_method_names, view_class=APIView):
""" """
Decorator that converts a function-based view into an APIView subclass. Decorator that converts a function-based view into an APIView subclass.
@ -23,7 +23,7 @@ def api_view(http_method_names):
WrappedAPIView = type( WrappedAPIView = type(
six.PY3 and 'WrappedAPIView' or b'WrappedAPIView', six.PY3 and 'WrappedAPIView' or b'WrappedAPIView',
(APIView,), (view_class,),
{'__doc__': func.__doc__} {'__doc__': func.__doc__}
) )