视图
from rest_framework.viewsets import ViewSetMixin # 注意先后顺序,ViewSetMixin写在前面 class TestAll(ViewSetMixin,APIView): def test1(self,request):return HttpResponse('test') def test2(self, request): return HttpResponse('test2') def test3(self, request): return HttpResponse('test3')
url
url(r'^test1/$', views.TestView.as_view({'get': 'test1'})), url(r'^test2/$', views.TestView.as_view({'post': 'test2'})), url(r'^test3/$', views.TestView.as_view({'update': 'test3'})),