From b385f446dc30192ed2d74230022ace3b54d31435 Mon Sep 17 00:00:00 2001 From: Kamal Bin Mustafa Date: Thu, 3 Oct 2013 10:34:23 +0800 Subject: [PATCH] allow passing custom APIView class api_view decorators --- rest_framework/decorators.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest_framework/decorators.py b/rest_framework/decorators.py index c69756a43..d97f4731a 100644 --- a/rest_framework/decorators.py +++ b/rest_framework/decorators.py @@ -12,7 +12,7 @@ from rest_framework.views import APIView 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. @@ -23,7 +23,7 @@ def api_view(http_method_names): WrappedAPIView = type( six.PY3 and 'WrappedAPIView' or b'WrappedAPIView', - (APIView,), + (view_class,), {'__doc__': func.__doc__} )